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/jianying/builders.py

View on GitHub
"""Production material and segment builders for the JianYing exporter."""

import json
import os

from jianying.schema import us
from jianying.templates import template
from jianying.tracks import SEGMENT_RENDER_INDEX


def timerange(start_us, dur_us):
    return {"start": int(start_us), "duration": int(dur_us)}


def volume_keyframes(keyframes, seg_start_s, new_id):
    """Build one KFTypeVolume keyframe list from timeline-absolute points."""
    if not keyframes:
        return []
    kfs = []
    for kf in keyframes:
        kfs.append({
            "curveType": "Line",
            "graphID": "",
            "left_control": {"x": 0.0, "y": 0.0},
            "right_control": {"x": 0.0, "y": 0.0},
            "id": new_id(),
            "time_offset": max(0, us(kf["t"] - seg_start_s)),
            "values": [round(float(kf["gain"]), 4)],
        })
    return [{
        "id": new_id(),
        "keyframe_list": kfs,
        "material_id": "",
        "property_type": "KFTypeVolume",
    }]


def _gain_at(ordered, t, default_gain):
    before = None
    for kf in ordered:
        if kf["t"] <= t:
            before = kf
        else:
            if before is None:
                return default_gain
            span = kf["t"] - before["t"]
            if span <= 1e-9:
                return kf["gain"]
            return before["gain"] + (kf["gain"] - before["gain"]) * ((t - before["t"]) / span)
    return before["gain"] if before is not None else default_gain


def windowed_volume_keyframes(keyframes, seg_start_s, seg_end_s, default_gain, new_id):
    """Window timeline-absolute keyframes for one split/looped segment."""
    if not keyframes:
        return []
    start = float(seg_start_s)
    end = float(seg_end_s)
    default_gain = float(default_gain)
    ordered = sorted((
        {"t": float(kf["t"]), "gain": float(kf["gain"])}
        for kf in keyframes
        if "t" in kf and "gain" in kf
    ), key=lambda kf: kf["t"])
    if not ordered or end <= start:
        return []

    start_gain = _gain_at(ordered, start, default_gain)
    end_gain = _gain_at(ordered, end, default_gain)
    inner = [kf for kf in ordered if start < kf["t"] < end]

    selected = [{"t": start, "gain": start_gain}]
    for kf in inner:
        if abs(kf["t"] - start) < 1e-4:
            selected[-1] = {"t": start, "gain": kf["gain"]}
        else:
            selected.append(kf)
    if end - selected[-1]["t"] >= 1e-4:
        selected.append({"t": end, "gain": end_gain})
    else:
        selected[-1] = {"t": selected[-1]["t"], "gain": end_gain}
    if all(abs(kf["gain"] - default_gain) < 1e-4 for kf in selected):
        return []
    return volume_keyframes(selected, start, new_id)


def clip_from_segment(segment):
    """Map the optional scale/position transform (validated as objects by the contract).

    Positions use JianYing's normalized, canvas-center, Y-up coordinates.
    """
    scale = segment.get("scale", {})
    position = segment.get("position", {})
    return {
        "alpha": 1.0,
        "flip": {"horizontal": False, "vertical": False},
        "rotation": 0.0,
        "scale": {
            "x": float(scale.get("x", 1.0)),
            "y": float(scale.get("y", 1.0)),
        },
        "transform": {
            "x": float(position.get("x", 0.0)),
            "y": float(position.get("y", 0.0)),
        },
    }


def base_segment(material_id, target_start_us, target_dur_us, volume, keyframes, new_id):
    segment = template("segment")
    segment.update({
        "id": new_id(),
        "material_id": material_id,
        "target_timerange": timerange(target_start_us, target_dur_us),
        "common_keyframes": keyframes,
        "track_render_index": SEGMENT_RENDER_INDEX,
        "render_index": SEGMENT_RENDER_INDEX,
        "volume": round(float(volume), 4),
    })
    return segment


def audio_segment_piece(material_id, target_start_us, target_dur_us, source_start_us,
                        source_dur_us, volume, keyframes, new_id):
    seg = base_segment(material_id, target_start_us, target_dur_us, volume, keyframes, new_id)
    seg["source_timerange"] = timerange(source_start_us, source_dur_us)
    seg["extra_material_refs"] = []
    return seg


def text_content(text):
    """duo-video's rich-text payload with one default style over the whole string.

    Ranges are UTF-16 code units, matching JianYing rather than Python code points.
    """
    style = template("text_style")["styles"][0]
    style.update({
        "fill": {
            "alpha": 1.0,
            "content": {"render_type": "solid", "solid": {"alpha": 1.0, "color": [1.0, 1.0, 1.0]}},
        },
        "range": [0, len(text.encode("utf-16-le")) // 2],
        "size": 8.0,
        "bold": False,
        "italic": False,
        "underline": False,
        "strokes": [],
        "use_letter_color": True,
    })
    content = template("text_style")
    content["text"] = text
    content["styles"] = [style]
    return content


def build_video_track(ctx, timeline_track):
    track_name = timeline_track.get("name", "video")
    for clip in timeline_track["clips"]:
        ts, te = float(clip["timeline_start"]), float(clip["timeline_end"])
        ss, se = float(clip["source_start"]), float(clip["source_end"])
        path = clip["source_path"]
        src_dur_us, width, height = ctx.probe(path)
        if src_dur_us <= 0:
            raise ValueError(f"JianYing video source has no probed duration: {path}")
        mat_id = ctx.new_id()
        material = template("video")
        material.update({
            "duration": int(src_dur_us),
            "height": height or ctx.height,
            "id": mat_id,
            "material_name": os.path.basename(path),
            "path": path,
            "width": width or ctx.width,
        })
        ctx.materials["videos"].append(material)
        audio = clip.get("audio", {})
        keyframes = volume_keyframes(audio.get("volume_keyframes"), ts, ctx.new_id)
        volume = audio.get("base_gain", 1.0) if not keyframes else 1.0
        seg = base_segment(mat_id, us(ts), us(te - ts), volume, keyframes, ctx.new_id)
        seg["source_timerange"] = timerange(us(ss), us(se - ss))
        seg["clip"] = clip_from_segment(clip)
        ctx.add_segment("video", track_name, us(ts), us(te - ts), seg)


def build_audio_track(ctx, timeline_track):
    role = timeline_track.get("role", timeline_track.get("name", "audio"))
    track_name = timeline_track.get("name", role)
    looped_bgm = role == "bgm" and timeline_track.get("loop")
    for segment in timeline_track["segments"]:
        ts, te = float(segment["timeline_start"]), float(segment["timeline_end"])
        path = segment["source_path"]
        mat_dur_us, _width, _height = ctx.probe(path)
        if mat_dur_us <= 0:
            raise ValueError(f"JianYing audio source has no probed duration: {path}")
        want_us = us(te - ts)
        place_us = want_us
        if want_us > mat_dur_us and not looped_bgm:
            place_us = int(mat_dur_us)
            if role == "bgm":
                ctx.note(
                    f"BGM 素材({mat_dur_us/1e6:.1f}s) 短于时间线({(te - ts):.1f}s),"
                    "剪映中未循环铺满(可在剪映里手动复制延长)"
                )
        mat_id = ctx.new_id()
        material = template("audio")
        material.update({
            "duration": int(mat_dur_us),
            "id": mat_id,
            "path": path,
        })
        ctx.materials["audios"].append(material)
        keyframes = volume_keyframes(segment.get("volume_keyframes"), ts, ctx.new_id)
        volume = segment.get("gain", 1.0) if not keyframes else 1.0
        if looped_bgm and want_us > mat_dur_us:
            cursor = 0
            while cursor < want_us:
                piece = min(int(mat_dur_us), want_us - cursor)
                piece_start_s = ts + (cursor / 1_000_000)
                piece_end_s = ts + ((cursor + piece) / 1_000_000)
                piece_kfs = windowed_volume_keyframes(
                    segment.get("volume_keyframes"), piece_start_s, piece_end_s,
                    segment.get("gain", 1.0), ctx.new_id)
                piece_volume = segment.get("gain", 1.0) if not piece_kfs else 1.0
                piece_seg = audio_segment_piece(
                    mat_id, us(ts) + cursor, piece, 0, piece,
                    piece_volume, piece_kfs, ctx.new_id)
                ctx.add_segment("audio", track_name, us(ts) + cursor, piece, piece_seg)
                cursor += piece
        else:
            audio_seg = audio_segment_piece(
                mat_id, us(ts), place_us, 0, place_us, volume, keyframes, ctx.new_id)
            ctx.add_segment("audio", track_name, us(ts), place_us, audio_seg)


def build_text_track(ctx, timeline_track):
    track_name = timeline_track.get("name", "text")
    track_kind = "subtitle" if track_name == "subtitle" else "text"
    for segment in timeline_track["segments"]:
        ts, te = float(segment["timeline_start"]), float(segment["timeline_end"])
        mat_id = ctx.new_id()
        material = template("text")
        material.update({
            "id": mat_id,
            "content": json.dumps(text_content(segment["text"]), ensure_ascii=False),
            "type": track_kind,
            "alignment": 1,
            "font_size": 8.0,
            "text_color": "#FFFFFF",
            "line_spacing": 0.02,
            "letter_spacing": 0.0,
            "check_flag": 15,
        })
        ctx.materials["texts"].append(material)
        duration_us = us(te - ts)
        seg = base_segment(mat_id, us(ts), duration_us, 1.0, [], ctx.new_id)
        seg["source_timerange"] = timerange(0, duration_us)
        seg["clip"] = clip_from_segment(segment)
        if track_kind == "subtitle" and "position" not in segment:
            seg["clip"]["transform"]["y"] = -0.72
        ctx.add_segment(track_kind, track_name, us(ts), duration_us, seg)


def build_image_track(ctx, timeline_track):
    """Build local image overlays as JianYing photo materials on video tracks."""
    track_name = timeline_track.get("name", "image")
    for segment in timeline_track["segments"]:
        ts, te = float(segment["timeline_start"]), float(segment["timeline_end"])
        duration_us = us(te - ts)
        path = segment["source_path"]
        _still_image_duration, width, height = ctx.probe(path)
        mat_id = ctx.new_id()
        material = template("video")
        material.update({
            "duration": duration_us,
            "height": height or ctx.height,
            "id": mat_id,
            "material_name": os.path.basename(path),
            "path": path,
            "type": "photo",
            "width": width or ctx.width,
        })
        ctx.materials["videos"].append(material)
        seg = base_segment(mat_id, us(ts), duration_us, 1.0, [], ctx.new_id)
        seg["source_timerange"] = timerange(0, duration_us)
        seg["clip"] = clip_from_segment(segment)
        ctx.add_segment("image", track_name, us(ts), duration_us, seg)


def build_timeline_track(ctx, timeline_track):
    kind = timeline_track["kind"]
    if kind in ("audio", "text") and not timeline_track["segments"]:
        return
    if kind == "video":
        build_video_track(ctx, timeline_track)
    elif kind == "audio":
        build_audio_track(ctx, timeline_track)
    elif kind == "text":
        build_text_track(ctx, timeline_track)
    else:  # normalize_timeline admits only video/audio/text/image track kinds
        build_image_track(ctx, timeline_track)
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