jianshuo/claude-skills / wjs-voicedrop-creating-motion-book
wjs-voicedrop-creating-motion-book
FlaggedUse when the user wants a whole book (usually a VoiceDrop 书架 book) turned into a chaptered explainer animation narrated by the book's own audiobook (书架「听本章」) — vertical 视频号 9:16 by default, art style auto-picked from the book's content, delivered as an in-browser HTML player and optionally MP4. Triggers — "把这本书做成动画", "做成艺术动画片", "读书动画", "听书配动画", "motion book", "/wjs-voicedrop-creating-motion-book <书名>".
scripts/split_chapters.mjs
View on GitHub#!/usr/bin/env node
// 分章 MP4(要 ffmpeg,在渲过 MP4 的机器上跑):render_chunks.mjs 留下的 <输出>_chunks/chNN.mp4 就是每章画面,
// 按段落表的章起止从全片口播切出同一段音频合上(画面只拷贝不重编码)。分章默认不加书封片头(用户要求),--cover 才加。
// 产物:<成片目录>/分章/NN_章名.mp4。已有的跳过(删掉重跑即可更新某章)。
// 用法:node split_chapters.mjs <项目目录> [<成片 mp4,默认 <项目>/成片/成片_v1.mp4>] [--cover]
import fs from 'node:fs';
import path from 'node:path';
import { execFileSync } from 'node:child_process';
import { book } from './common.mjs';
const args = process.argv.slice(2), ci = args.indexOf('--cover'), withCover = ci >= 0; if (withCover) args.splice(ci, 1);
const P = path.resolve(args[0]), film = path.resolve(args[1] || path.join(P, '成片', '成片_v1.mp4')), B = book(P);
const eras = fs.readFileSync(path.join(P, '代码工程', 'eras_book.js'), 'utf8');
const offs = JSON.parse(eras.match(/CHAPTER_OFFSETS = (\{.*?\});/)[1]), keys = Object.keys(offs);
const total = Math.max(...[...eras.matchAll(/\["\w+", [\d.]+, ([\d.]+)/g)].map(m => +m[1]));
const cdir = path.join(path.dirname(film), `${path.basename(film, '.mp4')}_chunks`), odir = path.join(path.dirname(film), '分章');
const audio = path.join(P, '音频', '全片口播.mp3'); fs.mkdirSync(odir, { recursive: true });
const safe = s => s.replace(/[\/\\:*?"<>|]/g, '·').trim();
const dur = f => +execFileSync('ffprobe', ['-v', 'error', '-show_entries', 'format=duration', '-of', 'csv=p=0', f]).toString();
for (const [i, k] of keys.entries()) {
const a = offs[k], b = i + 1 < keys.length ? offs[keys[i + 1]] : total, n = +k.replace(/\D/g, '');
const seg = path.join(cdir, `${k}.mp4`), out = path.join(odir, `${String(n).padStart(2, '0')}_${safe(B.chapters[n - 1] || k)}.mp4`);
if (fs.existsSync(out)) { console.log(`已有,跳过:${path.basename(out)}`); continue; }
if (!fs.existsSync(seg)) { console.error(`✗ 缺分段画面 ${seg}(先跑 render_chunks.mjs)`); process.exitCode = 1; continue; }
const tmp = out.replace(/\.mp4$/, '.part.mp4');
execFileSync('ffmpeg', ['-v', 'error', '-y', '-i', seg, '-ss', a.toFixed(4), '-t', (b - a).toFixed(4), '-i', audio,
'-map', '0:v', '-map', '1:a', '-c:v', 'copy', '-c:a', 'aac', '-b:a', '256k', '-shortest', '-movflags', '+faststart', tmp], { stdio: 'inherit' });
if (withCover) execFileSync(process.execPath, [path.join(path.dirname(new URL(import.meta.url).pathname), 'add_cover.mjs'), P, tmp], { stdio: 'inherit' });
fs.renameSync(tmp, out); console.log(`${path.basename(out)} ${dur(out).toFixed(1)}s(段落表 ${(b - a).toFixed(1)}s${withCover ? ' + 1s 片头' : ''})`);
}
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| 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: 198k | Updated | Claude CodeCodex | Verified | Install |
| 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: 194k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-debtDietrichGebert/ponytailHarvest every shortcut: comment into one debt ledger, so deferrals get tracked instead of forgotten. One-shot report. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |
| 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: 194k | Updated | Claude CodeCodex | Verified | Install |