Communitygithub.com

video-edit

用户要剪视频、拼片段、加片头剧照、抽帧/抽音轨、导出 mp4 时使用(Android 宿主 weizhi:video)。桌面无 MediaCodec 不适用。

video-edit 是什么?

video-edit is a Claude Code agent skill that 用户要剪视频、拼片段、加片头剧照、抽帧/抽音轨、导出 mp4 时使用(Android 宿主 weizhi:video)。桌面无 MediaCodec 不适用。.

兼容平台~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/fengshihao/agent1-skills/tree/main/skills-src/video-edit

在你喜欢的 AI 中提问

打开一个已预加载此 Agent Skill 的新对话。

预览

来自技能 README

文档

Video Editing (weizhi:video)

Scope

DoDo Not
probe, extract frames/audio tracks, exportVideo exportDecode an entire mp4 with webview_exec
v1 remux: trim, concatenate without fadingPretend to support desktop transcoding (desktop does not have this package)

Initiation Protocol

  1. First load_skill (video-edit) to read this document.
  2. Before writing exportVideo or a complex timeline: find_caps once (query includes exportVideo weizhi:video or a specific capability), and write according to the returned call example; do not guess field names.
  3. Place scripts in jobs/*.js, execute using run_js with file; timeout_ms can be increased (max 600000).
  4. If the script API returns an error (such as bad argument, unsupported): find_caps again to check the signature and modify the script.

Routing

TaskAPI
Trim a single segment, concatenate multiple segments end-to-end, no re-encodingv1 exportVideo({ clips: [{ path, startMs?, endMs? }], output })
Multi-track, image title card, Ken Burns, crossfadev2 exportVideo({ width, height, tracks, output })

Timeline v2 (Key Points)

  • Image / photo: type: "image" track, durationMs is mandatory.
  • mp4 segment: type: "video" track, inMs / outMs; do not put images in a video track.
  • Crossfade (image tracks only): the later clip should have transition: { type: "crossfade", durationMs: D }, and
    startMs_next = startMs_prev + durationMs_prev - D (overlap exactly D milliseconds). There is no crossfadeMs field.
  • Clips on the same track without a declared transition must not overlap in time; an error overlapping clips means you should check the above formula and transition.
  • transition and self-written opacity keyframes cannot be used simultaneously.
  • Audio track: type: "audio" as a separate track.

Example (two images crossfade + then video):

import { exportVideo } from "weizhi:video";

const D = 300;
await exportVideo({
  width: 720,
  height: 1280,
  tracks: [
    {
      type: "image",
      clips: [
        { src: "a.jpg", startMs: 0, durationMs: 1000 },
        {
          src: "b.jpg",
          startMs: 1000 - D,
          durationMs: 1000,
          transition: { type: "crossfade", durationMs: D },
        },
      ],
    },
    {
      type: "video",
      clips: [{ src: "clip.mp4", startMs: 1700, inMs: 0, outMs: 5000 }],
    },
  ],
  output: "out/final.mp4",
});

Recommended Workflow

  1. probe the source video for duration and resolution.
  2. If a cover frame is needed: extractFrame / extractFrames (see find_caps).
  3. For complex videos: you can first export intermediate part1.mp4, part2.mp4 using v1, then concatenate using v1 or v2; avoid stacking clips without declared transitions on one track.
  4. Background music: a separate audio track, outMs aligned with the total video length.

Scripting

  • A single jobs/render.js script should handle probing, export, and verification (you can probe the final output again) in sequence.
  • Do not replace the entire script with multiple tools from outside.

How to Communicate with the User

Specify the output file name and duration; use a [Video](out/xxx.mp4) link. Avoid stacking technical terms.

相关技能