Skip to content

JimLiu/baocut / skills/baocut

baocut

Flagged

用 BaoCut 处理视频与音频:转录、字幕、翻译、配音、剪口播、切短视频、分章、总结写稿、从链接下载、压缩转码、导出成片,或从零做一条成片。有媒体文件、视频链接、字幕文件或 BaoCut 视频时用;只翻译纯文本、与视频无关的写作或作图、别的剪辑器与 FFmpeg 的用法、BaoCut 源码开发不用。

FileKindSize
SKILL.mdskill md46.5 KB
built-in-skills/README.mdmarkdown9.6 KB
references/catalog/editing.mdmarkdown24.4 KB
references/catalog/export.mdmarkdown6.6 KB
references/catalog/media.mdmarkdown45.1 KB
references/catalog/models.mdmarkdown7.9 KB
references/catalog/music.mdmarkdown17.1 KB
references/catalog/subtitles.mdmarkdown20.8 KB
references/catalog/system.mdmarkdown9.6 KB
references/catalog/voice-gemini-tts.mdmarkdown2.6 KB
references/catalog/voice-language-rates.mdmarkdown6.5 KB
references/catalog/voice.mdmarkdown12.3 KB
references/catalog/web.mdmarkdown10.9 KB
references/conventions.mdmarkdown16.1 KB
references/craft/.gitkeepother0 B
references/craft/README.mdmarkdown480 B
references/craft/character-animation.mdmarkdown6.8 KB
references/craft/character-animation/examples/mini-film/art.example.jsonconfig918 B
references/craft/character-animation/examples/mini-film/index.htmlother628 B
references/craft/character-animation/examples/mini-film/scene.jsscript2.1 KB
references/craft/character-animation/references/art.mdmarkdown4.6 KB
references/craft/character-animation/references/checks.mdmarkdown2.6 KB
references/craft/character-animation/references/rig.mdmarkdown5.3 KB
references/craft/character-animation/references/style-and-story.mdmarkdown5.0 KB
references/craft/character-animation/references/timing-and-sound.mdmarkdown3.1 KB
references/craft/character-animation/rig-kit/rig-kit.jsscript33.0 KB
references/craft/character-animation/scripts/cutout.mjsscript26.9 KB
references/craft/character-animation/scripts/jump-scan.mjsscript3.2 KB
references/craft/character-animation/scripts/place-sfx.mjsscript5.1 KB
references/craft/character-animation/scripts/rig-check.mjsscript8.9 KB
references/craft/clip-montage.mdmarkdown11.5 KB
references/craft/clip-montage/references/assembly.mdmarkdown5.0 KB
references/craft/clip-montage/references/sourcing.mdmarkdown6.3 KB
references/craft/clip-montage/references/structure.mdmarkdown3.8 KB
references/craft/cover-and-title.mdmarkdown5.6 KB
references/craft/cross-video-qa.mdmarkdown5.8 KB
references/craft/design-system.mdmarkdown18.5 KB
references/craft/design-system/references/cover.mdmarkdown6.9 KB
references/craft/design-system/references/craft.mdmarkdown8.8 KB
references/craft/design-system/references/demo.jsonconfig161.1 KB
references/craft/design-system/references/format.mdmarkdown18.6 KB
references/craft/design-system/references/from-code.mdmarkdown11.5 KB
references/craft/design-system/references/from-design-tool.mdmarkdown16.2 KB
references/craft/design-system/references/sample-seazar-tokens.jsonconfig11.0 KB
references/craft/design.mdmarkdown19.3 KB
references/craft/design/references/brand-colors.mdmarkdown2.4 KB
references/craft/design/references/brand-typography.mdmarkdown1.7 KB
references/craft/design/references/craft.mdmarkdown15.4 KB
references/craft/design/references/design-system-components.mdmarkdown11.8 KB
references/craft/design/references/diagrams.mdmarkdown10.1 KB
references/craft/design/references/format.mdmarkdown11.8 KB
references/craft/design/references/print.mdmarkdown5.6 KB
references/craft/design/references/questions.mdmarkdown4.7 KB
references/craft/design/references/view-state.mdmarkdown5.7 KB
references/craft/docs.mdmarkdown19.9 KB
references/craft/docs/references/comments.mdmarkdown4.4 KB
references/craft/docs/references/editing.mdmarkdown12.9 KB
references/craft/docs/references/tabs.mdmarkdown4.7 KB
references/craft/docs/references/uploads.mdmarkdown1.7 KB
references/craft/explainer-video.mdmarkdown23.4 KB
references/craft/explainer-video/references/3d.mdmarkdown5.9 KB
references/craft/explainer-video/references/footage.mdmarkdown9.6 KB
references/craft/explainer-video/references/length-and-pace.mdmarkdown6.7 KB
references/craft/explainer-video/references/script.mdmarkdown14.7 KB
references/craft/explainer-video/references/subject.mdmarkdown12.5 KB
references/craft/history-video.mdmarkdown20.6 KB
references/craft/history-video/references/brief.mdmarkdown5.1 KB
references/craft/history-video/references/forms.mdmarkdown11.2 KB
references/craft/history-video/references/old-recordings.mdmarkdown12.4 KB
references/craft/history-video/references/self-check.mdmarkdown5.3 KB
references/craft/history-video/references/sources.mdmarkdown5.9 KB
references/craft/motion-graphics.mdmarkdown17.3 KB
references/craft/motion-graphics/exemplars/big-number/16x9.htmlother11.4 KB
references/craft/motion-graphics/exemplars/big-number/9x16.htmlother11.5 KB
references/craft/motion-graphics/exemplars/callout-pin/16x9.htmlother11.6 KB
references/craft/motion-graphics/exemplars/callout-pin/9x16.htmlother11.6 KB
references/craft/motion-graphics/exemplars/keyword-caption/16x9.htmlother11.3 KB
references/craft/motion-graphics/exemplars/keyword-caption/9x16.htmlother11.3 KB
references/craft/motion-graphics/exemplars/logo-sting/16x9.htmlother12.1 KB
references/craft/motion-graphics/exemplars/logo-sting/9x16.htmlother12.1 KB
references/craft/motion-graphics/exemplars/lower-third/16x9.htmlother11.2 KB
references/craft/motion-graphics/exemplars/lower-third/9x16.htmlother11.2 KB
references/craft/motion-graphics/references/audio-backdrop.mdmarkdown22.9 KB
references/craft/motion-graphics/references/grammar.mdmarkdown11.1 KB
references/craft/motion-graphics/scaffold.htmlother9.0 KB
references/craft/motion-graphics/scripts/build-bundle.mjsscript25.2 KB
references/craft/narration.mdmarkdown11.1 KB
references/craft/polish-transcript.mdmarkdown13.8 KB
references/craft/production-scripts.mdmarkdown15.7 KB
references/craft/production-scripts/references/pipeline.mdmarkdown37.8 KB
references/craft/production-scripts/scene-kit/geo110.jsscript27.3 KB
references/craft/production-scripts/scene-kit/scene-kit.jsscript38.3 KB
references/craft/production-scripts/scripts/align.mjsscript11.6 KB
references/craft/production-scripts/scripts/assemble.mjsscript26.4 KB
references/craft/production-scripts/scripts/build.mjsscript18.1 KB
references/craft/production-scripts/scripts/captions.mjsscript18.6 KB
references/craft/production-scripts/scripts/clips.example.jsonconfig3.2 KB
references/craft/production-scripts/scripts/coverage.mjsscript10.0 KB
references/craft/production-scripts/scripts/envelope.mjsscript2.9 KB
references/craft/production-scripts/scripts/explainer.example.jsonconfig2.2 KB
references/craft/production-scripts/scripts/fonts.mjsscript7.0 KB
references/craft/production-scripts/scripts/frames.mjsscript7.7 KB
references/craft/production-scripts/scripts/gaps.mjsscript11.3 KB
references/craft/production-scripts/scripts/host.mjsscript14.8 KB
references/craft/production-scripts/scripts/legibility.mjsscript5.7 KB
references/craft/production-scripts/scripts/level.mjsscript9.2 KB
references/craft/production-scripts/scripts/lib.mjsscript19.3 KB
references/craft/production-scripts/scripts/overlay.mjsscript34.7 KB
references/craft/production-scripts/scripts/preview.mjsscript4.6 KB
references/craft/production-scripts/scripts/quotes.mjsscript7.4 KB
references/craft/production-scripts/scripts/sources.mjsscript6.2 KB
references/craft/production-scripts/scripts/srt.mjsscript5.8 KB
references/craft/production-scripts/scripts/voice.mjsscript7.7 KB
references/craft/shorts-segments.mdmarkdown30.8 KB
references/craft/slides.mdmarkdown13.8 KB
references/craft/slides/references/design-system.mdmarkdown6.3 KB
references/craft/slides/references/design.mdmarkdown9.3 KB
references/craft/slides/references/format.mdmarkdown12.2 KB
references/craft/slides/references/images.mdmarkdown4.2 KB
references/craft/speaker-labeling.mdmarkdown6.6 KB
references/craft/subtitle-workflow.mdmarkdown13.1 KB
references/craft/talking-head-cut.mdmarkdown9.3 KB
references/craft/talking-head-cut/references/picture-and-sound.mdmarkdown10.1 KB
references/craft/titles-and-description.mdmarkdown5.2 KB
references/craft/titles-and-description/references/description.mdmarkdown5.1 KB
references/craft/titles-and-description/references/titles.mdmarkdown5.5 KB
references/craft/titles-and-description/references/writing-baseline.mdmarkdown11.9 KB
references/craft/translate-subtitles.mdmarkdown13.4 KB
references/craft/video-blog.mdmarkdown17.1 KB
references/craft/video-blog/references/writing-baseline.mdmarkdown11.9 KB
references/craft/video-chapters.mdmarkdown9.7 KB
references/craft/video-production.mdmarkdown31.9 KB
references/craft/video-production/examples/bundle-preview.htmlother17.7 KB
references/craft/video-production/examples/post-fx.jsscript7.5 KB
references/craft/video-production/references/code-scenes.mdmarkdown31.9 KB
references/craft/video-production/references/shot-plan.mdmarkdown5.1 KB
references/craft/video-production/references/sound-design.mdmarkdown4.4 KB
references/craft/video-production/references/visuals.mdmarkdown19.7 KB
references/craft/video-summary.mdmarkdown22.8 KB
references/craft/video-summary/references/writing-baseline.mdmarkdown11.9 KB
references/craft/virtual-host.mdmarkdown14.9 KB
references/craft/virtual-host/examples/character-partmap.example.jsonconfig600 B
references/craft/virtual-host/examples/character.example.jsonconfig336 B
references/craft/virtual-host/references/art.mdmarkdown22.1 KB
references/craft/virtual-host/references/hosts.mdmarkdown4.4 KB
references/craft/virtual-host/references/lipsync.mdmarkdown10.1 KB
references/craft/virtual-host/scripts/lipsync.mjsscript39.8 KB
references/craft/virtual-host/scripts/pinyin-table.mjsscript83.2 KB
references/craft/virtual-host/scripts/puppet-build.mjsscript48.6 KB
references/craft/virtual-host/scripts/puppet-mask.mjsscript3.0 KB
references/craft/virtual-host/scripts/puppet/align.mjsscript4.1 KB
references/craft/virtual-host/scripts/puppet/brows.mjsscript17.2 KB
references/craft/virtual-host/scripts/puppet/edits.mjsscript4.3 KB
references/craft/virtual-host/scripts/puppet/expression-labels.jsonconfig1.1 KB
references/craft/virtual-host/scripts/puppet/expreyes.mjsscript35.9 KB
references/craft/virtual-host/scripts/puppet/eyes.mjsscript8.6 KB
references/craft/virtual-host/scripts/puppet/fill.mjsscript10.5 KB
references/craft/virtual-host/scripts/puppet/layers.mjsscript5.7 KB
references/craft/virtual-host/scripts/puppet/mapbuild.mjsscript50.4 KB
references/craft/virtual-host/scripts/puppet/ops.mjsscript7.4 KB
references/craft/virtual-host/scripts/puppet/pack.mjsscript10.2 KB
references/craft/virtual-host/scripts/puppet/partmap.mjsscript8.5 KB
references/craft/virtual-host/scripts/puppet/parts.mjsscript7.0 KB
references/craft/virtual-host/scripts/puppet/png.mjsscript5.8 KB
references/craft/virtual-host/scripts/puppet/seg.mjsscript21.6 KB
references/craft/virtual-host/scripts/puppet/segment.mjsscript26.6 KB
references/craft/virtual-host/scripts/puppet/zip.mjsscript2.0 KB
references/craft/virtual-host/scripts/visemes.mjsscript21.4 KB
references/craft/vlog-from-clips.mdmarkdown13.2 KB
references/craft/vlog-from-clips/references/footage-log.mdmarkdown3.3 KB
references/mcp.mdmarkdown8.9 KB
references/start.mdmarkdown6.3 KB
references/workflows.mdmarkdown29.8 KB

references/craft/virtual-host/scripts/puppet/partmap.mjs

View on GitHub
// i18n-ignore-file: 给智能体拷走用的独立脚本,日志与报错写英文
// The part map: an image edit of the portrait that paints every part in one flat key colour (references/art.md). It is
// registered to the portrait by the two silhouettes and read back as one label per pixel, so the layers follow the
// drawing's own boundaries whatever its shading.
import { blank, components, compMask, dilate } from './ops.mjs';
import { keyOut } from './seg.mjs';
import { align, warp } from './align.mjs';
import { nearestIndex } from './layers.mjs';

/**
 * the palette the part-map prompt asks for (references/art.md); bg, the backdrop, is read off the map itself (any green
 * the map is painted on), and this one only shows it in the debug labels
 */
export const PARTS = {
  bg: [0, 177, 64],
  front: [255, 0, 0], // bangs and the hair on top
  side: [255, 0, 255], // locks beside the face and in front of the shoulders
  back: [0, 0, 255], // the hair behind the head and the shoulders
  face: [255, 255, 0], // face skin and the nose
  ear: [255, 128, 192],
  neck: [255, 128, 0], // the neck and other bare skin below the chin
  brow: [128, 0, 255],
  white: [255, 255, 255],
  iris: [0, 255, 255], // iris, pupil and highlights
  lash: [0, 0, 0], // lashes and the eye lines
  mouth: [128, 0, 0],
  cloth: [128, 128, 128],
};
export const NAMES = Object.keys(PARTS);
export const ID = Object.fromEntries(NAMES.map((n, i) => [n, i]));
const COL = NAMES.map((n) => PARTS[n]);

const d2 = (r, g, b, c) => (r - c[0]) ** 2 + (g - c[1]) ** 2 + (b - c[2]) ** 2;

/**
 * Labels for every pixel of the portrait. im: the portrait; pm: the part map (same size); K: keyOut(im).
 * Returns { lab (Uint8Array of ID), A (the registration), far (pixels of the character, as the portrait keys it, that
 * no colour or pair of colours explains), map }.
 */
export function readLabels(im, pm, K, o = {}) {
  const { w, h } = im, N = w * h;
  const sil = (I, KK) => {
    const S = blank(w, h);
    for (let p = 0; p < N; p++) { const v = Math.round(255 * KK.alpha[p]); S.d.set([v, v, v, 255], 4 * p); }
    return S;
  };
  // the map's backdrop is measured on its border, like the portrait's: the prompt asks for the portrait's green, and a
  // map comes on a near one or on the prompt's own #00B140. Taken as #00B140, a map on a bright green had its whole
  // backdrop in no palette colour (and a portrait's green is not always near enough the map's to key it with)
  const KP = keyOut(pm);
  const A = align(sil(im, K), sil(pm, KP), { range: o.range ?? 40 });
  const M = warp(pm, A);
  // the model paints each part near its palette colour, not on it (a mouth asked as #800000 may come as #A01000):
  // move every palette colour to the mean of the map's pixels round it
  const ref = COL.map((c, k) => (k === ID.bg ? [...KP.key] : c)), col = ref.map((c) => [...c]);
  {
    const acc = ref.map(() => [0, 0, 0, 0]);
    for (let p = 0; p < N; p++) {
      const r = M.d[4 * p], g = M.d[4 * p + 1], b = M.d[4 * p + 2];
      let best = 0, bd = Infinity;
      for (let k = 0; k < ref.length; k++) { const d = d2(r, g, b, ref[k]); if (d < bd) { bd = d; best = k; } }
      if (bd < 70 * 70) { const A = acc[best]; A[0] += r; A[1] += g; A[2] += b; A[3]++; }
    }
    acc.forEach((A, k) => { if (A[3] > 50) col[k] = [A[0] / A[3], A[1] / A[3], A[2] / A[3]]; });
  }
  const lab = new Uint8Array(N), sure = new Uint8Array(N), err = new Float32Array(N);
  for (let p = 0; p < N; p++) {
    const r = M.d[4 * p], g = M.d[4 * p + 1], b = M.d[4 * p + 2];
    let best = 0, bd = Infinity;
    for (let k = 0; k < col.length; k++) { const d = d2(r, g, b, col[k]); if (d < bd) { bd = d; best = k; } }
    lab[p] = best; err[p] = bd;
    if (bd <= 28 * 28) sure[p] = 1;
  }
  // an antialiased edge mixes two colours (red and yellow make the neck's orange): fit the pixel as a mix of two of the
  // parts that are really there round it, and take the stronger side. Only the character counts as far: the portrait's
  // backdrop is background whatever the map has there
  const fg = Uint8Array.from(K.alpha, (a) => (a > 0.5 ? 1 : 0));
  let far = 0;
  for (let y = 0; y < h; y++) for (let x = 0; x < w; x++) {
    const p = y * w + x;
    if (sure[p]) continue;
    const near = new Set();
    for (let j = Math.max(0, y - 3); j <= Math.min(h - 1, y + 3); j++) for (let i = Math.max(0, x - 3); i <= Math.min(w - 1, x + 3); i++) if (sure[j * w + i]) near.add(lab[j * w + i]);
    if (!near.size) { if (fg[p] && err[p] > 40 * 40) far++; continue; }
    const r = M.d[4 * p], g = M.d[4 * p + 1], b = M.d[4 * p + 2], ks = [...near];
    let bd = Infinity, bk = lab[p];
    for (const k of ks) { const d = d2(r, g, b, col[k]); if (d < bd) { bd = d; bk = k; } }
    for (let u = 0; u < ks.length; u++) for (let v = u + 1; v < ks.length; v++) {
      const a = col[ks[u]], c = col[ks[v]], e = [a[0] - c[0], a[1] - c[1], a[2] - c[2]];
      const ee = e[0] * e[0] + e[1] * e[1] + e[2] * e[2];
      if (ee < 1) continue;
      const t = Math.max(0, Math.min(1, ((r - c[0]) * e[0] + (g - c[1]) * e[1] + (b - c[2]) * e[2]) / ee));
      const d = d2(r, g, b, [c[0] + t * e[0], c[1] + t * e[1], c[2] + t * e[2]]);
      if (d < bd) { bd = d; bk = t >= 0.5 ? ks[u] : ks[v]; }
    }
    if (fg[p] && bd > 40 * 40) far++;
    lab[p] = bk;
  }
  // the portrait's own background decides what is background; character pixels the map left as background take the
  // nearest part
  for (let p = 0; p < N; p++) if (!fg[p]) lab[p] = ID.bg;
  const isPart = Uint8Array.from(lab, (v, p) => (v !== ID.bg ? 1 : 0));
  const ni = nearestIndex(isPart, w, h, 40);
  for (let p = 0; p < N; p++) if (fg[p] && lab[p] === ID.bg && ni[p] >= 0) lab[p] = lab[ni[p]];
  // specks (under 16 px) join the part round them
  despeckle(lab, w, h, 16);
  return { lab, A, far, map: M, palette: Object.fromEntries(NAMES.map((n, k) => [n, col[k].map(Math.round)])) };
}

/** components of one label smaller than `min` px take the commonest label on their border */
export function despeckle(lab, w, h, min) {
  for (let k = 0; k < NAMES.length; k++) {
    if (k === ID.bg) continue;
    const m = Uint8Array.from(lab, (v) => (v === k ? 1 : 0));
    const cc = components(m, w, h);
    const small = new Set(cc.comps.filter((c) => c.area < min).map((c) => c.id));
    if (!small.size) continue;
    const votes = new Map();
    for (let p = 0; p < w * h; p++) {
      const id = cc.lab[p];
      if (!small.has(id)) continue;
      const x = p % w;
      for (const q of [p - 1, p + 1, p - w, p + w]) {
        if (q < 0 || q >= w * h || (q === p - 1 && x === 0) || (q === p + 1 && x === w - 1)) continue;
        if (cc.lab[q] === id) continue;
        const v = votes.get(id) ?? new Map(); v.set(lab[q], (v.get(lab[q]) ?? 0) + 1); votes.set(id, v);
      }
    }
    for (let p = 0; p < w * h; p++) {
      const v = votes.get(cc.lab[p]);
      if (!v || !small.has(cc.lab[p])) continue;
      lab[p] = [...v.entries()].sort((a, b) => b[1] - a[1])[0][0];
    }
  }
  return lab;
}

/** the mask of one or more labels */
export const part = (lab, ...names) => {
  const s = new Set(names.map((n) => ID[n]));
  return Uint8Array.from(lab, (v) => (s.has(v) ? 1 : 0));
};

/**
 * The face in the map (`face`, the yellow): its biggest blob, and the skin between the strands right over a brow
 * (`brow`), which the brow's band cuts off from it, yellow pieces that touch a brow and lie in the head (their middle
 * in the face's width, between a little over its top and its chin). Taken for strays, those went to the bangs: the
 * forehead there moved with the hair, and a brow between two of them counted as one on the bangs, filled under from
 * that skin, which showed through when an expression redrew the brow. Other yellow pieces are two map colours mixing
 * at an edge. Returns the mask, the biggest blob (components' record) and how many pixels of skin over the brows it
 * took back; null for a map with no yellow.
 */
export function faceZone(face, brow, w, h) {
  const cc = components(face, w, h), comps = [...cc.comps].sort((a, b) => b.area - a.area), big = comps[0];
  if (!big) return null;
  // 2 px: the map's own edge between the yellow and the purple can be a pixel of a third colour
  const nearBrow = dilate(brow, w, h, 2), touch = new Set();
  for (let p = 0; p < w * h; p++) if (cc.lab[p] && nearBrow[p]) touch.add(cc.lab[p]);
  const top = big.y0 - 0.15 * (big.y1 - big.y0);
  const pockets = comps.slice(1).filter((c) => touch.has(c.id) && c.cx >= big.x0 && c.cx <= big.x1 && c.cy >= top && c.cy <= big.y1);
  return { zone: compMask(cc.lab, [big.id, ...pockets.map((c) => c.id)]), big, overBrows: pockets.reduce((a, c) => a + c.area, 0) };
}
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: 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