Skip to content

joeseesun/qiaomu-cut-skill

qiaomu-cut

Verified

把一句话需求转成可复现、可验收视频工程的乔木智能剪辑导演。Use when the user asks to create, plan, edit, remix, explain, narrate, subtitle, animate, composite, or render a video—including one-line requests such as “制作一个科普视频:介绍 LLM 中的 RL”. Builds English-learning movie mixes, person profiles, explainers, code-drawn motion graphics (UI morph loops, showreels, kinetic-type promos, line-art/pixel/Three.js animation, lyric MVs), product launch videos, cinematic shorts, social clips, course/PPT videos, AI image/video/TTS/music-assisted stories, stock-footage stories, or multi-source montage. Routes across 33台词, ClipSeek/open media, local files, ListenHub, image generation, HTML/SVG/Canvas motion graphics with beat-grid storyboards and determinism probes, Manim, ffmpeg-full, captions, sound design, frame-0 video covers with YouTube thumbnails, and release checks.

FileKindSize
SKILL.mdskill md54.0 KB
agents/interface.yamlconfig17.2 KB
agents/openai.yamlconfig323 B
assets/explainer-social/base.cssother24.9 KB
assets/explainer-social/component-runtime.jsscript41.1 KB
assets/explainer-social/scene-shell.htmlother829 B
assets/motion-kit/qiaocut-motion.jsscript8.2 KB
assets/qiaomu-profile/qiaomu_avatar.jpegbinary5.6 MB
assets/qiaomu-profile/qiaomu_reward_qr.pngbinary515.9 KB
assets/qiaomu-profile/qiaomu_wechat_public_account_qr.jpgbinary8.3 KB
references/ad-concept-library.mdmarkdown6.5 KB
references/aesthetic-preferences.mdmarkdown3.0 KB
references/brand-card-templates.mdmarkdown1.6 KB
references/chinese-font-themes.mdmarkdown804 B
references/cinematic-techniques.mdmarkdown2.8 KB
references/code-motion-direction.mdmarkdown11.1 KB
references/cover-thumbnail-method.mdmarkdown6.4 KB
references/english-mix-fast-path.mdmarkdown6.0 KB
references/explainer-autopilot.mdmarkdown11.1 KB
references/feedback-evolution.mdmarkdown37.6 KB
references/ffmpeg-full.mdmarkdown1.7 KB
references/incremental-production.mdmarkdown4.4 KB
references/licensing.mdmarkdown1.9 KB
references/listenhub-provider.mdmarkdown12.6 KB
references/motion-prompt-patterns.mdmarkdown9.3 KB
references/movie-montage-fast-path.mdmarkdown4.4 KB
references/qiaocut-ir.mdmarkdown4.2 KB
references/renderer-engines.mdmarkdown3.3 KB
references/schemas/qiaocut.timeline.v1.schema.jsonconfig7.2 KB
references/social-safe-zones.mdmarkdown3.3 KB
references/source-adapters.mdmarkdown5.7 KB
references/source-selection-gate.mdmarkdown2.5 KB
references/styles/cinematic.mdmarkdown475 B
references/styles/explainer.mdmarkdown1.5 KB
references/styles/social-short.mdmarkdown383 B
references/timeline-schema.mdmarkdown12.2 KB
references/trust-boundary.mdmarkdown3.0 KB
references/workflows.mdmarkdown7.5 KB
scripts/adapters/33tc.jsscript2.1 KB
scripts/adapters/33tc_cli.jsscript4.8 KB
scripts/adapters/clipseek.jsexecutablescript5.4 KB
scripts/adapters/listenhub.jsscript35.7 KB
scripts/adapters/listenhub_cli.jsexecutablescript2.1 KB
scripts/adapters/local.jsscript2.4 KB
scripts/audio_beats.jsscript17.5 KB
scripts/bilingual_typography_smoke.jsscript1.4 KB
scripts/bootstrap_listenhub.shexecutablescript5.4 KB
scripts/bootstrap_macos.shexecutablescript2.5 KB
scripts/brand_templates.jsscript2.4 KB
scripts/brand_templates_smoke.jsscript869 B
scripts/complete_sentence.jsscript3.9 KB
scripts/component_motion_smoke.jsscript21.2 KB
scripts/concept_smoke.jsscript5.6 KB
scripts/cover.jsscript9.1 KB
scripts/cover_smoke.jsscript5.1 KB
scripts/english_mix.jsscript24.1 KB
scripts/english_mix_smoke.jsscript5.7 KB
scripts/explainer_beats.jsscript6.7 KB
scripts/explainer_beats_smoke.jsscript4.8 KB
scripts/explainer_cognitive_timing_smoke.jsscript5.8 KB
scripts/explainer_e2e_smoke.jsscript7.4 KB
scripts/explainer_pipeline.jsscript49.3 KB
scripts/explainer_pipeline_smoke.jsscript12.7 KB
scripts/explainer_spec.jsscript51.4 KB
scripts/explainer_timing.jsscript8.6 KB
scripts/fetch_generated.jsexecutablescript17.4 KB
scripts/ffmpeg_retry_shim_smoke.jsscript2.3 KB
scripts/file_narration_smoke.jsexecutablescript6.6 KB
scripts/ingest_asset.jsexecutablescript15.0 KB
scripts/kinetic_caption_smoke.jsscript1.4 KB
scripts/license_report.jsexecutablescript2.3 KB
scripts/listenhub_narration.jsexecutablescript11.0 KB
scripts/listenhub_smoke.jsexecutablescript26.7 KB
scripts/local_preferences.jsscript1.8 KB
scripts/motion_studio.jsscript55.9 KB
scripts/motion_studio_smoke.jsscript11.0 KB
scripts/movie_montage.jsscript24.7 KB
scripts/movie_montage_smoke.jsscript4.0 KB
scripts/qcut.jsexecutablescript40.8 KB
scripts/release_check.jsscript7.0 KB
scripts/render_project.jsscript85.1 KB
scripts/render_scene.jsscript26.4 KB
scripts/renderers/ass.jsexecutablescript2.7 KB
scripts/renderers/bilingual_ass.jsscript12.6 KB
scripts/renderers/html_scene.jsexecutablescript3.9 KB
scripts/renderers/procedural_music.jsscript7.6 KB
scripts/scene_content_cache.jsscript3.2 KB
scripts/scene_renderer_smoke.jsscript2.8 KB
scripts/security_smoke.jsscript10.2 KB
scripts/sentence_boundary_smoke.jsscript1.6 KB
scripts/setup_deps.jsscript8.4 KB
scripts/shims/ffmpegexecutablescript3.0 KB
scripts/source_review.jsexecutablescript5.1 KB
scripts/timeline_features_smoke.jsscript3.7 KB
scripts/trigger_eval.pyexecutablescript2.5 KB
scripts/validate_skill.pyexecutablescript3.1 KB
scripts/verify_marswave_vendor.jsexecutablescript3.5 KB
scripts/verify_video.jsexecutablescript3.4 KB

scripts/motion_studio_smoke.js

View on GitHub
#!/usr/bin/env node
'use strict';

// Smoke test for the code-motion studio: motion kit math, beat grid, SFX peak
// alignment, storyboard gate, determinism probe and a tiny blurred final render.

const assert = require('assert');
const fs = require('fs');
const os = require('os');
const path = require('path');
const { spawnSync } = require('child_process');

const M = require('../assets/motion-kit/qiaocut-motion.js');
const { analyzeBeats, peakOffset } = require('./audio_beats');
const { inspectSceneEngines } = require('./render_scene');
const { prepareSoundEffects } = require('./render_project');

const QCUT = path.join(__dirname, 'qcut.js');
const checks = [];

function ffmpeg() {
  for (const candidate of [process.env.QIAOMU_FFMPEG, '/opt/homebrew/opt/ffmpeg-full/bin/ffmpeg', '/opt/homebrew/bin/ffmpeg', '/usr/local/bin/ffmpeg']) {
    if (candidate && fs.existsSync(candidate)) return candidate;
  }
  return 'ffmpeg';
}

function ffprobe() {
  const sibling = path.join(path.dirname(ffmpeg()), 'ffprobe');
  return fs.existsSync(sibling) ? sibling : 'ffprobe';
}

function synth(file, expression, seconds, rate = 44100) {
  const result = spawnSync(ffmpeg(), ['-hide_banner', '-loglevel', 'error', '-y', '-f', 'lavfi', '-i', `aevalsrc='${expression}':s=${rate}:d=${seconds}`, file]);
  assert.equal(result.status, 0, String(result.stderr));
}

function qcut(args) {
  const result = spawnSync(process.execPath, [QCUT, ...args, '--json'], { encoding: 'utf8', maxBuffer: 64 * 1024 * 1024 });
  let json = null;
  try { json = JSON.parse(result.stdout); } catch (_) {}
  return { status: result.status, json, stderr: result.stderr };
}

// 1. Motion kit: closed-form springs equal a numerically simulated spring.
{
  assert.equal(M.spring(0), 0);
  assert.ok(Math.abs(M.spring(5) - 1) < 1e-6);
  for (const damping of [0.6, 1, 1.4]) {
    const options = { response: 0.4, damping };
    const keys = [{ t: 0, value: 0 }, { t: 0.2, value: 100 }, { t: 0.55, value: 40 }, { t: 0.9, value: 180 }];
    const w0 = (2 * Math.PI) / options.response;
    let x = 0; let v = 0; let t = 0; const dt = 1 / 20000;
    let maxError = 0;
    while (t < 2) {
      const target = keys.filter((key) => key.t <= t + 1e-12).pop().value;
      const a = -w0 * w0 * (x - target) - 2 * damping * w0 * v;
      v += a * dt; x += v * dt; t += dt;
      if (Math.round(t * 20000) % 400 === 0) maxError = Math.max(maxError, Math.abs(M.springTrack(t, keys, options) - x));
    }
    assert.ok(maxError < 0.2, `springTrack superposition error ${maxError} (damping ${damping})`);
  }
  const pointer = (time) => 50 + 200 * time;
  const before = M.dragRelease(0.9999, 0, 1, pointer, 0, { response: 0.4, damping: 0.8 });
  const after = M.dragRelease(1.0001, 0, 1, pointer, 0, { response: 0.4, damping: 0.8 });
  assert.ok(Math.abs(before - after) < 0.2, 'drag release is continuous');
  assert.equal(M.random(7, 3), M.random(7, 3));
  assert.notEqual(M.random(7, 3), M.random(8, 3));
  assert.ok(!('outBounce' in M.ease) && !('outElastic' in M.ease), 'no bouncy easing offered');
  checks.push('motion-kit springs/superposition/drag/random');
}

const root = fs.mkdtempSync(path.join(os.tmpdir(), 'qiaocut-motion-'));
try {
  // 2. Beat grid on a 128 BPM kick track starting at 0.2 s with accented downbeats.
  const song = path.join(root, 'song.wav');
  const period = 60 / 128;
  synth(song, `gt(t,0.2)*((0.5*sin(2*PI*60*mod(t-0.2,${period}))+0.2*(random(0)-0.5))*exp(-30*mod(t-0.2,${period}))*(1+eq(mod(floor((t-0.2)/${period}+0.001),4),0)))+0.04*sin(2*PI*220*t)`, 20);
  const grid = analyzeBeats(song);
  assert.ok(Math.abs(grid.bpm - 128) < 0.2, `bpm ${grid.bpm}`);
  assert.ok(Math.abs(grid.firstBeat - 0.2) < 0.01, `first beat ${grid.firstBeat}`);
  assert.ok(Math.abs(grid.firstDownbeat - 0.2) < 0.01, `first downbeat ${grid.firstDownbeat}`);
  checks.push(`beat grid ${grid.bpm} BPM @ ${grid.firstBeat}s`);

  // 2b. Bright off-beat hats from t=2, kicks only from the drop at t=4: the grid
  // must lock to the kicks (on-beat), not the hats, and find the drop.
  const hats = path.join(root, 'hats.wav');
  synth(hats, '0.9*sin(2*PI*(45+90*exp(-40*mod(t,0.5)))*mod(t,0.5))*exp(-9*mod(t,0.5))*gte(t,4)+0.1*(random(0)-0.5)*exp(-70*mod(t-0.25,0.5))*gte(t,2)+0.06*sin(2*PI*220*t)', 12, 48000);
  const hatGrid = analyzeBeats(hats);
  assert.ok(Math.abs(hatGrid.bpm - 120) < 0.2, `hat-heavy bpm ${hatGrid.bpm}`);
  assert.ok(Math.min(hatGrid.firstBeat % 0.5, 0.5 - (hatGrid.firstBeat % 0.5)) < 0.02, `hat-heavy phase ${hatGrid.firstBeat}`);
  assert.ok(hatGrid.drop && Math.abs(hatGrid.drop.time - 4) < 0.03, `drop ${JSON.stringify(hatGrid.drop)}`);
  checks.push(`off-beat hats: locked to kicks, drop @ ${hatGrid.drop.time}s`);

  // 3. SFX peak offset.
  const hit = path.join(root, 'hit.wav');
  synth(hit, '0.02*sin(2*PI*800*t)*lt(t,0.12)+0.9*sin(2*PI*300*t)*exp(-30*(t-0.12))*gte(t,0.12)', 0.6, 48000);
  const peak = peakOffset(hit);
  assert.ok(Math.abs(peak.peakMs - 120) < 3, `peak ${peak.peakMs}`);
  checks.push(`sfx peak ${peak.peakMs} ms`);

  // 4. Timeline alignPeak places the file so its peak lands on the hit time.
  const build = fs.mkdtempSync(path.join(root, 'build-'));
  fs.copyFileSync(hit, path.join(root, 'hit-copy.wav'));
  const prepared = prepareSoundEffects({
    timeline: { output: { duration: 3 }, soundEffects: [{ id: 'hit', path: 'hit-copy.wav', start: 1.5, alignPeak: true }] },
    projectRoot: root,
    buildDir: build,
    tools: { ffmpeg: ffmpeg(), ffprobe: ffprobe() },
    progress: () => {}
  });
  const cue = prepared.cues[0];
  assert.equal(cue.hitAt, 1.5);
  assert.ok(Math.abs(cue.start + cue.peakMs / 1000 - 1.5) < 0.002);
  checks.push(`timeline alignPeak start ${cue.start}s for hit 1.5s`);

  // 5. Storyboard-before-code gate.
  const project = path.join(root, 'promo');
  fs.mkdirSync(path.join(project, 'assets'), { recursive: true });
  fs.copyFileSync(song, path.join(project, 'assets', 'song.wav'));
  fs.copyFileSync(hit, path.join(project, 'assets', 'hit.wav'));
  const init = qcut(['motion', 'init', project, '--style', 'product-promo', '--audio', 'assets/song.wav', '--width', '320', '--height', '180', '--fps', '12', '--duration', '3']);
  assert.equal(init.status, 0, init.stderr);
  let check = qcut(['motion', 'check', project]);
  assert.equal(check.status, 1);
  assert.ok(check.json.errors.some((item) => item.code === 'shot-unwritten'), 'unwritten storyboard blocks');
  const briefFile = path.join(project, 'motion-brief.json');
  const brief = JSON.parse(fs.readFileSync(briefFile, 'utf8'));
  brief.storyboard.forEach((shot, index) => Object.assign(shot, { idea: `idea ${index}`, camera: 'locked', transitionIn: 'hard cut on beat', onScreenText: ['Ship', 'Faster', 'Now'][index % 3] }));
  assert.equal(brief.storyboard[0].id, 's00', 'non-loop scaffold opens on the cover shot');
  assert.ok(check.json.errors.some((item) => item.code === 'cover-unwritten'), 'unwritten cover blocks');
  Object.assign(brief.cover, { promise: 'ship faster', archetype: 'product-hero' });
  assert.ok(check.json.errors.some((item) => item.code === 'concept-unwritten'), 'unwritten concept blocks');
  Object.assign(brief.concept, { archetype: 'kinetic-typography', reference: 'Nike kinetic type ad', device: 'one word per beat', musicStyle: 'trap-808', typeStyle: 'heavy-grotesque', structure: 'slams then reveal', palette: ['#ff5a1f', '#0a0a0a'] });
  brief.direction.references = [{ kind: 'none', why: 'smoke' }];
  brief.approval.mode = 'autopilot';
  brief.audio.music.license = 'synthetic';
  brief.audio.sfx = [{ id: 'hit', path: 'assets/hit.wav', at: brief.storyboard[1] ? brief.storyboard[1].start : 1 }];
  const offGrid = JSON.parse(JSON.stringify(brief));
  if (offGrid.storyboard.length > 1) {
    offGrid.storyboard[1].start += 0.2;
    offGrid.storyboard[0].end += 0.2;
    fs.writeFileSync(briefFile, JSON.stringify(offGrid, null, 2));
    check = qcut(['motion', 'check', project]);
    assert.ok(check.json.errors.some((item) => item.code === 'off-grid'), 'off-grid cut blocks');
  }
  fs.writeFileSync(briefFile, JSON.stringify(brief, null, 2));
  assert.equal(qcut(['motion', 'scene', project, '--force']).status, 0);
  check = qcut(['motion', 'check', project]);
  assert.equal(check.status, 0, JSON.stringify(check.json && check.json.errors));
  assert.equal(check.json.status, 'ready');
  const scene = path.join(project, 'scenes', 'main.html');
  const clean = fs.readFileSync(scene, 'utf8');
  fs.writeFileSync(scene, clean.replace('function seek(t) {', 'function seek(t) {\n    const jitter = Math.random();'));
  check = qcut(['motion', 'check', project]);
  assert.ok(check.json.errors.some((item) => item.code === 'determinism'), 'Math.random is rejected');
  checks.push('storyboard gate: unwritten, off-grid, determinism lint, ready');

  const engines = inspectSceneEngines();
  if (!engines.html.available) {
    checks.push('SKIPPED probe/render: headless browser capture unavailable (missing evidence)');
  } else {
    // 6. Probe catches hidden per-frame state that static lint cannot see.
    fs.writeFileSync(scene, clean.replace('function seek(t) {', 'let calls = 0;\n  function seek(t) {\n    calls += 1; document.body.style.background = `rgb(${calls % 250},0,0)`;'));
    let probe = qcut(['motion', 'probe', project]);
    assert.equal(probe.json.ok, false);
    assert.equal(probe.json.determinism.deterministic, false);
    fs.writeFileSync(scene, clean);
    const blocked = qcut(['motion', 'render', project, '--profile', 'final']);
    assert.equal(blocked.json.ok, false, 'final requires a passing probe');
    probe = qcut(['motion', 'probe', project]);
    assert.equal(probe.json.ok, true, JSON.stringify(probe.json.determinism));
    assert.ok(fs.existsSync(path.join(project, probe.json.contactSheet)));
    assert.equal(probe.json.cover.notBlack, true, JSON.stringify(probe.json.cover));
    checks.push('probe: stateful scene rejected, pure scene passes, frame 0 is a readable cover');
    const cover = qcut(['motion', 'cover', project, '--scale', '1']);
    assert.equal(cover.json.ok, true, JSON.stringify(cover.json));
    assert.ok(fs.existsSync(path.join(project, cover.json.variants[0].jpg)));
    checks.push(`motion cover: ${cover.json.variants.length} variants → JPG + feed previews`);

    // 7. Tiny final render with sub-frame motion blur, music and a peak-aligned SFX.
    const render = qcut(['motion', 'render', project, '--profile', 'final']);
    assert.equal(render.json.ok, true, JSON.stringify(render.json));
    assert.equal(render.json.capture.motionBlur.subframes, 3);
    assert.equal(render.json.verification.video.width, 320);
    assert.ok(Math.abs(render.json.verification.format.duration - 3) < 0.2);
    assert.ok(render.json.audio.cues[0].peakMs > 100);
    assert.ok(Math.abs(render.json.verification.loudness.integratedLUFS + 14) < 2, JSON.stringify(render.json.verification.loudness));
    checks.push(`final render: ${render.json.capture.frames} frames × 3 subframes, ${render.json.verification.loudness.integratedLUFS} LUFS`);
  }
  process.stdout.write(`${JSON.stringify({ ok: true, checks }, null, 2)}\n`);
} finally {
  fs.rmSync(root, { recursive: true, force: true });
}
brainstormingobra/superpowersYou MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or planning anything new, in software or out of it (a talk, a business, a renovation).Stars: 322kUpdated Claude CodeCodexVerifiedInstall
brand-guidelinesanthropics/skillsApplies Anthropic's official brand colors and typography to any sort of artifact that may benefit from having Anthropic's look-and-feel. Use it when brand colors or style guidelines, visual formatting, or company design standards apply.Stars: 198kUpdated Claude CodeCodexVerifiedInstall
frontend-designanthropics/skillsGuidance for distinctive, intentional visual design when building new UI or reshaping an existing one. Helps with aesthetic direction, typography, and making choices that don't read as templated defaults.Stars: 198kUpdated Claude CodeCodexVerifiedInstall
mcp-builderanthropics/skillsGuide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when building MCP servers to integrate external APIs or services, whether in Python (FastMCP) or Node/TypeScript (MCP SDK).Stars: 198kUpdated Claude CodeCodexVerifiedInstall