Skip to content

zenstory-ai/video-recap-skills / skills/video-recap

video-recap

Verified

把一段或多集视频做成带画框字幕的中文解说成片或纯原声高光短片。用户提供 .mp4 / .mov / .mkv / .webm,要求做影视解说、短剧二创、加旁白配音、跨集混剪或导出剪映草稿时使用;串联完成看片识台词、定主线与留原声、按台词停顿切镜头、写词检查、TTS 配音与混音加字幕。触发词:视频解说、影视解说、视频旁白、生成解说、视频 recap、video recap、voiceover、narration、recap。

FileKindSize
SKILL.mdskill md18.4 KB
assets/dashboard/app.jsscript16.2 KB
assets/dashboard/index.htmlother867 B
assets/dashboard/styles.cssother22.6 KB
assets/dashboard/tokens.cssother8.9 KB
assets/dashboard/views.jsscript31.4 KB
references/audio-modes.mdmarkdown3.6 KB
references/config-playbook.mdmarkdown8.1 KB
references/creative-editing-playbook.mdmarkdown12.3 KB
references/data-schema.mdmarkdown34.6 KB
references/index-tts.mdmarkdown2.1 KB
references/jianying/LICENSE.duo-videoother1.0 KB
references/jianying/SOURCE.mdmarkdown703 B
references/jianying/empty_draft_meta_info.jsonconfig1.7 KB
references/jianying/empty_jy_material_video.jsonconfig1.8 KB
references/jianying/empty_jy_meta_material_value.jsonconfig358 B
references/jianying/empty_jy_project_info.jsonconfig3.6 KB
references/jianying/empty_jy_segment.jsonconfig1.3 KB
references/jianying/empty_jy_text_styles.jsonconfig440 B
references/jianying/empty_yj_material_audio.jsonconfig865 B
references/jianying/empty_yj_material_text.jsonconfig2.4 KB
references/packaging.mdmarkdown6.8 KB
references/promotional-copy.mdmarkdown4.1 KB
references/prompt-templates.mdmarkdown2.0 KB
references/research-guide.mdmarkdown2.7 KB
references/resource-library.mdmarkdown12.1 KB
references/shot-review.mdmarkdown4.8 KB
scripts/agent_text.pyscript2.7 KB
scripts/artifacts.pyscript972 B
scripts/asr.pyscript12.5 KB
scripts/asr_timing_evidence.pyscript4.2 KB
scripts/assemble.pyscript31.0 KB
scripts/assemble_constants.pyscript894 B
scripts/assembly_contract.pyscript10.3 KB
scripts/assembly_settings.pyscript3.8 KB
scripts/audio_automation.pyscript6.6 KB
scripts/audio_mix.pyscript18.5 KB
scripts/briefing/__init__.pyscript101 B
scripts/briefing/builder.pyscript31.1 KB
scripts/briefing/context.pyscript6.1 KB
scripts/briefing/timeline.pyscript23.0 KB
scripts/codec_peak.pyscript5.1 KB
scripts/cut.pyscript148 B
scripts/cut_cli.pyscript12.4 KB
scripts/cut_contract.pyscript13.3 KB
scripts/cut_qc.pyscript1.9 KB
scripts/cut_render.pyscript13.2 KB
scripts/dashboard/__init__.pyscript159 B
scripts/dashboard/data.pyscript24.6 KB
scripts/dashboard/io.pyscript7.1 KB
scripts/dashboard/runs.pyscript21.8 KB
scripts/dashboard/templates.pyscript9.6 KB
scripts/dashboard_server.pyscript9.3 KB
scripts/detect.pyscript22.2 KB
scripts/doctor.pyexecutablescript12.9 KB
scripts/entry_suggestion.pyscript4.6 KB
scripts/export_jianying.pyscript5.6 KB
scripts/extract.pyscript2.5 KB
scripts/final_qc.pyscript19.0 KB
scripts/frame_grid.pyscript10.6 KB
scripts/jianying/__init__.pyscript49 B
scripts/jianying/builders.pyscript11.3 KB
scripts/jianying/model.pyscript2.7 KB
scripts/jianying/optional.pyscript1012 B
scripts/jianying/schema.pyscript2.5 KB
scripts/jianying/templates.pyscript1.0 KB
scripts/jianying/timeline_contract.pyscript5.8 KB
scripts/jianying/tracks.pyscript2.0 KB
scripts/jianying/writer.pyscript7.8 KB
scripts/lib.pyscript29.6 KB
scripts/library.pyscript31.1 KB
scripts/lint_summary.pyscript5.0 KB
scripts/loudness.pyscript14.7 KB
scripts/materials.pyscript22.1 KB
scripts/media.pyscript18.8 KB
scripts/narration_audio.pyscript13.5 KB
scripts/narration_lint.pyscript24.1 KB
scripts/narrative_selection.pyscript8.9 KB
scripts/packaging.pyscript6.1 KB
scripts/packaging_fonts.pyscript12.0 KB
scripts/packaging_plates.pyscript31.2 KB
scripts/packaging_studio.pyscript34.1 KB
scripts/providers/__init__.pyscript72 B
scripts/providers/fish_audio.pyscript3.1 KB
scripts/providers/index_tts.pyscript8.8 KB
scripts/recap.pyscript183 B
scripts/recap_cli.pyscript6.9 KB
scripts/recap_inspect.pyscript16.5 KB
scripts/recap_runner.pyscript22.0 KB
scripts/recap_runtime.pyscript11.8 KB
scripts/recap_source.pyscript1.8 KB
scripts/recap_stage_qc.pyscript2.7 KB
scripts/recap_timeline.pyscript7.7 KB
scripts/render_preflight.pyscript1.7 KB
scripts/resources/__init__.pyscript200 B
scripts/resources/lock.pyscript6.8 KB
scripts/resources/project_binding.pyscript16.1 KB
scripts/sentence_boundaries.pyscript28.8 KB
scripts/sentence_gate.pyscript8.6 KB
scripts/sfx_mix.pyscript14.6 KB
scripts/shot_review.pyscript18.9 KB
scripts/source_subtitles.pyscript7.2 KB
scripts/speech_ownership.pyscript9.3 KB
scripts/storyboard.pyscript21.8 KB
scripts/subtitles/__init__.pyscript56 B
scripts/subtitles/core.pyscript19.0 KB
scripts/subtitles/render.pyscript8.0 KB
scripts/timeline.pyscript8.2 KB
scripts/timeline_emit.pyscript5.4 KB
scripts/tts_audio.pyscript9.6 KB
scripts/tts_cache.pyscript4.5 KB
scripts/understand.pyscript171 B
scripts/understanding_brief.pyscript6.3 KB
scripts/understanding_cache.pyscript8.0 KB
scripts/understanding_runner.pyscript9.8 KB
scripts/understanding_storyboard.pyscript11.9 KB
scripts/validate.pyscript5.7 KB
scripts/visual_render.pyscript10.1 KB
scripts/vlm.pyscript16.4 KB
scripts/voiceover.pyscript28.0 KB

scripts/subtitles/render.py

View on GitHub
"""SRT/ASS serialization for narration and original-dialogue subtitles."""

from lib import CONFIG
from packaging_fonts import split_highlight_spans
from packaging_studio import has_packaging_plan, load_raw_packaging_plan, resolve_output_canvas
from source_subtitles import _combined_subtitle_entries
from subtitles.core import (
    _effective_subtitle_style,
    _normalize_subtitle_text,
    _seconds_to_ass_time,
    _seconds_to_srt_time,
)


def _entries_for_style(narration, work_dir, video_duration, style):
    if style is None:
        return _combined_subtitle_entries(narration, work_dir, video_duration)
    max_chars = int(style["max_chars"])
    bridge = float(style.get("bridge_gap_seconds", 0.0))
    if max_chars == int(CONFIG["subtitle_max_chars"]) and bridge <= 0.0 and not has_packaging_plan(work_dir):
        return _combined_subtitle_entries(narration, work_dir, video_duration)
    return _combined_subtitle_entries(
        narration, work_dir, video_duration,
        max_chars=max_chars, bridge_gap_seconds=bridge,
    )


def burned_subtitle_spans(narration, work_dir, video_duration, canvas=None):
    """Return [(start, end), ...] of subtitles actually burned onto the video frame."""
    if not CONFIG["burn_subtitles"]:
        return []
    style = _effective_subtitle_style(canvas, work_dir) if canvas is not None else None
    return [
        (float(entry["start"]), float(entry["end"]))
        for entry in _entries_for_style(narration, work_dir, video_duration, style)
        if float(entry["end"]) > float(entry["start"])
    ]


def _generate_srt(narration, work_dir, video_duration, canvas=None):
    """将解说脚本转为 SRT 字幕文件,使用实际音频放置时间;原声留白处补烧原声字幕。"""
    if canvas is None and has_packaging_plan(work_dir):
        canvas = resolve_output_canvas(work_dir, {"width": 1080, "height": 1920, "fps": 25.0})
    style = _effective_subtitle_style(canvas, work_dir) if canvas is not None else None
    srt_lines = []
    for idx, entry in enumerate(_entries_for_style(narration, work_dir, video_duration, style), start=1):
        srt_lines.append(str(idx))
        srt_lines.append(
            f"{_seconds_to_srt_time(entry['start'])} --> {_seconds_to_srt_time(entry['end'])}"
        )
        srt_lines.append(_normalize_subtitle_text(entry["text"]))
        srt_lines.append("")
    srt_path = work_dir / "subtitles.srt"
    srt_path.write_text("\n".join(srt_lines), encoding="utf-8")
    return srt_path


def _escape_ass_text(text):
    """Escape user text for an ASS dialogue Text field."""
    return (
        text
        .replace("\\", "\\\\")
        .replace("{", "\\{")
        .replace("}", "\\}")
        .replace("\r\n", "\n")
        .replace("\r", "\n")
        .replace("\n", "\\N")
    )


def _ass_inline_bgr(ass_color: str) -> str:
    """Convert '&HAABBGGRR' or '&HBBGGRR' to ASS inline '\\c&HBBGGRR&' token."""
    digits = str(ass_color or "&H00FFFFFF").strip().lstrip("&Hh").rstrip("&")
    bgr = digits[-6:].upper().zfill(6)
    return f"&H{bgr}&"


def _format_highlighted_ass_text(raw_text: str, highlights, hl_color: str, base_color: str) -> str:
    """Escape text and wrap up to 2 highlighted phrases in ASS inline color overrides."""
    spans = split_highlight_spans(raw_text, highlights)
    if len(spans) == 1 and not spans[0][1]:
        return _escape_ass_text(raw_text)
    hl_tag = _ass_inline_bgr(hl_color)
    base_tag = _ass_inline_bgr(base_color)
    parts = []
    for chunk, is_hl in spans:
        esc = _escape_ass_text(chunk)
        if is_hl:
            parts.append(f"{{\\c{hl_tag}}}{esc}{{\\c{base_tag}}}")
        else:
            parts.append(esc)
    return "".join(parts)


def _generate_ass(narration, work_dir, video_duration, canvas):
    """Generate an ASS subtitle file for readable hard-sub rendering, including the original
    dialogue during the original-audio gaps. canvas ({"width","height"}) scales the style to the
    real frame so portrait/竖屏 subtitles are not stretched."""
    style = _effective_subtitle_style(canvas, work_dir)
    glow = float(style.get("glow", 0.0))
    fade_ms = int(style.get("fade_ms", 0))
    hl_color = str(style.get("highlight_color") or "&H004CD2FF")
    dlg_outline_color = str(style.get("dialogue_outline_color") or style["outline_color"])
    dlg_outline = style.get("dialogue_outline", style["outline"])
    dlg_shadow = style.get("dialogue_shadow", style["shadow"])

    ass_lines = [
        "[Script Info]",
        "ScriptType: v4.00+",
        "WrapStyle: 0",
        "ScaledBorderAndShadow: yes",
        f"PlayResX: {int(style['play_res_x'])}",
        f"PlayResY: {int(style['play_res_y'])}",
        "",
        "[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: Default,"
            f"{style['font_name']},{style['font_size']},{style['primary_color']},&H000000FF,"
            f"{style['outline_color']},&H64000000,-1,0,0,0,100,100,0,0,1,"
            f"{style['outline']},{style['shadow']},{style['alignment']},"
            f"{style['margin_l']},{style['margin_r']},{style['margin_v']},1"
        ),
        (
            "Style: Dialogue,"
            f"{style['font_name']},{style['font_size']},&H00FFFFFF,&H000000FF,"
            f"{dlg_outline_color},&H64000000,-1,0,0,0,100,100,0,0,1,"
            f"{dlg_outline},{dlg_shadow},{style['alignment']},"
            f"{style['margin_l']},{style['margin_r']},{style['margin_v']},1"
        ),
    ]
    if glow > 0.0:
        glow_outline = round(max(3.6, float(style["outline"]) + 2.2), 2)
        ass_lines.append(
            "Style: Glow,"
            f"{style['font_name']},{style['font_size']},&H96000000,&H000000FF,"
            f"&H88000000,&H00000000,-1,0,0,0,100,100,0,0,1,"
            f"{glow_outline},0,{style['alignment']},"
            f"{style['margin_l']},{style['margin_r']},{style['margin_v']},1"
        )

    ass_lines.extend([
        "",
        "[Events]",
        "Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text",
    ])

    raw_plan = load_raw_packaging_plan(work_dir) or {}
    plan_highlights = list(raw_plan.get("subtitle_highlights") or ()) + list(
        (raw_plan.get("subtitle_style") or {}).get("highlights") or ()
    )
    entries = _entries_for_style(narration, work_dir, video_duration, style)
    for entry in entries:
        raw_text = _normalize_subtitle_text(entry["text"])
        is_dialogue = bool(entry.get("is_dialogue")) or raw_text.startswith("「")
        style_name = "Dialogue" if is_dialogue else "Default"
        s_ts = _seconds_to_ass_time(entry["start"])
        e_ts = _seconds_to_ass_time(entry["end"])
        plain_escaped = _escape_ass_text(raw_text)
        merged_hl = list(entry.get("highlights") or ()) + plan_highlights
        rich_text = (
            plain_escaped
            if is_dialogue
            else _format_highlighted_ass_text(
                raw_text, merged_hl, hl_color, style["primary_color"]
            )
        )
        fade_out = max(0, round(fade_ms * 0.8))
        fad_tag = f"\\fad({fade_ms},{fade_out})" if fade_ms > 0 else ""

        if glow > 0.0:
            ass_lines.append(
                f"Dialogue: 0,{s_ts},{e_ts},Glow,,0,0,0,,"
                f"{{\\blur{glow:.1f}{fad_tag}}}{plain_escaped}"
            )
            fg_prefix = f"{{{fad_tag}}}" if fad_tag else ""
            ass_lines.append(
                f"Dialogue: 1,{s_ts},{e_ts},{style_name},,0,0,0,,{fg_prefix}{rich_text}"
            )
        else:
            fg_prefix = f"{{{fad_tag}}}" if fad_tag else ""
            ass_lines.append(
                f"Dialogue: 0,{s_ts},{e_ts},{style_name},,0,0,0,,{fg_prefix}{rich_text}"
            )

    ass_path = work_dir / "subtitles.ass"
    ass_path.write_text("\n".join(ass_lines) + "\n", encoding="utf-8")
    return ass_path
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: 198kUpdated 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: 196kUpdated Claude CodeCodexVerifiedInstall
ponytail-debtDietrichGebert/ponytailHarvest every shortcut: comment into one debt ledger, so deferrals get tracked instead of forgotten. One-shot report.Stars: 196kUpdated 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: 196kUpdated Claude CodeCodexVerifiedInstall