Skip to content

JimLiu/baocut / skills/baocut/built-in-skills/production-scripts

production-scripts

Verified

有命令行环境、旁白按段配、画面按段上时间线的片子(讲解、解说混剪、旁白片、歌词视频……)要跑脚本时用:配音、对齐字时间、把场景代码打成代码包、按段摆上时间线并处理变长变短的波纹、按稿子建字幕、剪实拍与水印叠上去或垫在底下、量画面占比。脚本是一条省事的路,不规定片子的形态;形态和它不合时用 baocut CLI 自己写。只是加一段动效图形或配一句旁白时不用。

FileKindSize
.baocut-meta.jsonconfig2.8 KB
SKILL.mdskill md13.4 KB
references/pipeline.mdmarkdown37.3 KB
scene-kit/geo110.jsscript27.3 KB
scene-kit/scene-kit.jsscript38.3 KB
scripts/align.mjsscript11.6 KB
scripts/assemble.mjsscript26.4 KB
scripts/build.mjsscript18.1 KB
scripts/captions.mjsscript18.6 KB
scripts/clips.example.jsonconfig3.2 KB
scripts/coverage.mjsscript10.0 KB
scripts/envelope.mjsscript2.9 KB
scripts/explainer.example.jsonconfig2.2 KB
scripts/fonts.mjsscript7.0 KB
scripts/frames.mjsscript7.7 KB
scripts/gaps.mjsscript11.3 KB
scripts/host.mjsscript14.8 KB
scripts/legibility.mjsscript5.7 KB
scripts/level.mjsscript9.2 KB
scripts/lib.mjsscript19.3 KB
scripts/overlay.mjsscript34.7 KB
scripts/preview.mjsscript4.6 KB
scripts/quotes.mjsscript7.4 KB
scripts/sources.mjsscript6.2 KB
scripts/srt.mjsscript5.8 KB
scripts/voice.mjsscript7.7 KB

scripts/envelope.mjs

View on GitHub
#!/usr/bin/env node
// i18n-ignore-file: 给智能体拷走用的独立脚本,日志与报错写英文
// 把一段录音量成一排条(RMS 包络),写成场景能直接读的 JS,给 scene-kit 的 K.bars() 画:
//   node tools/envelope.mjs <录音> --out shared/speech-wave.js [--var SPEECH_WAVE] [--bars 240] [--from 秒] [--to 秒]
// 输出:window.<var> = { off, dur, bars: [0..1, …] }。off 是这排条从录音的第几秒起(--from,缺省 0),dur 是量的这段的秒数,
// bars 按 95 分位归一(最响的几条夹到 1),
// 开头的爆音不会把其余的压扁。视频里的录音剪掉了开头(报幕、空白)时带 --from 剪掉的秒数,声波才和视频里放的那段对得上;
// 场景拿录音的秒数(例如原声片段的 from / to)标位置时先减去 off。不读配置、不连 Runtime,只要本机有 ffmpeg。
import fs from 'node:fs';
import path from 'node:path';
import { execFileSync } from 'node:child_process';
import { audioWindow, parseArgs } from './lib.mjs';

const { ids, flags } = parseArgs(process.argv, ['out', 'var', 'bars', 'from', 'to']);
const [file] = ids;
if (!file || !flags.out) throw new Error('usage: envelope.mjs <audio> --out <file.js> [--var NAME] [--bars 240] [--from s] [--to s]');
const n = Math.round(+(flags.bars ?? 240));
if (!(n >= 8)) throw new Error(`--bars must be a number of bars (8 or more), got ${flags.bars}`);
const name = flags.var || 'SPEECH_WAVE';
if (!/^[A-Za-z_$][\w$]*$/.test(name)) throw new Error(`--var must be a JavaScript identifier, got ${name}`);

const RATE = 8000;
const from = flags.from != null ? +flags.from : 0;
const { input, filters } = audioWindow(from, flags.to != null ? +flags.to - from : null);
const pcm = execFileSync('ffmpeg', ['-v', 'error', ...input, '-i', file, '-vn', ...(filters.length ? ['-af', filters.join(',')] : []), '-ac', '1', '-ar', String(RATE), '-f', 's16le', '-'], { maxBuffer: 1 << 30 });
const total = pcm.length >> 1;
if (!total) throw new Error(`no audio decoded from ${file}`);
const rms = [];
for (let b = 0; b < n; b++) {
  const s = Math.floor((b * total) / n), e = Math.max(s + 1, Math.floor(((b + 1) * total) / n));
  let acc = 0;
  for (let j = s; j < e; j++) { const v = pcm.readInt16LE(j * 2) / 32768; acc += v * v; }
  rms.push(Math.sqrt(acc / (e - s)));
}
const top = [...rms].sort((a, b) => a - b)[Math.min(n - 1, Math.floor(n * 0.95))] || 1;
const bars = rms.map(v => +Math.min(1, v / top).toFixed(3));
const dur = +(total / RATE).toFixed(2), off = flags.from != null ? +flags.from : 0;
fs.mkdirSync(path.dirname(path.resolve(flags.out)), { recursive: true });
fs.writeFileSync(flags.out, `// envelope of ${path.basename(file)} from ${off} s (${dur} s), ${n} RMS bars; drawn with K.bars(), which takes recording seconds and subtracts off itself\nwindow.${name} = ${JSON.stringify({ off, dur, bars })};\n`);
console.log(`${flags.out}: window.${name}, ${n} bars over ${dur} s from ${off} s`);
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