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/renderers/bilingual_ass.js

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

const fs = require('fs');
const path = require('path');

const STYLE_ORDER = [
  'English',
  'Chinese',
  'Note',
  'Source',
  'Card',
  'CardChinese',
  'BigWord',
  'BigChinese'
];

function number(value, fallback) {
  const parsed = Number(value);
  return Number.isFinite(parsed) ? parsed : fallback;
}

function assColor(value, fallback) {
  const text = String(value || '').trim();
  return /^&H[0-9A-Fa-f]{6,8}&?$/.test(text) ? text.replace(/&$/, '') : fallback;
}

function fontFamily(value) {
  const text = String(value || 'Noto Sans CJK SC').replace(/[,\r\n{}\\]/g, '').trim();
  return text || 'Noto Sans CJK SC';
}

function assTime(seconds) {
  const centiseconds = Math.max(0, Math.round(number(seconds, 0) * 100));
  const hours = Math.floor(centiseconds / 360000);
  const minutes = Math.floor(centiseconds / 6000) % 60;
  const secs = Math.floor(centiseconds / 100) % 60;
  const cs = centiseconds % 100;
  return `${hours}:${String(minutes).padStart(2, '0')}:${String(secs).padStart(2, '0')}.${String(cs).padStart(2, '0')}`;
}

function escapePlain(text) {
  return String(text == null ? '' : text)
    .replace(/\\/g, '\\\\')
    .replace(/[{}]/g, '')
    .replace(/\r?\n/g, '\\N');
}

function renderText(text, style, highlightColor) {
  const pieces = String(text == null ? '' : text).split(/(\[\[.*?\]\])/gs);
  return pieces.map((piece) => {
    if (piece.startsWith('[[') && piece.endsWith(']]')) {
      const content = escapePlain(piece.slice(2, -2));
      return `{\\c${highlightColor}\\b1}${content}{\\r${style}}`;
    }
    return escapePlain(piece);
  }).join('');
}

function animationType(event) {
  if (!event || !event.animation) return 'fade';
  if (typeof event.animation === 'string') return event.animation;
  return event.animation.type || 'fade';
}

function inferredSegments(text) {
  const value = String(text == null ? '' : text);
  if (/\s/.test(value)) {
    return value.split(/(\s+)/).filter(Boolean).map((part) => ({ text: part }));
  }
  return Array.from(value).map((part) => ({ text: part }));
}

function karaokeText(event, theme = {}) {
  const segments = Array.isArray(event.segments) && event.segments.length
    ? event.segments
    : inferredSegments(event.text);
  const totalCentiseconds = Math.max(1, Math.round((number(event.end, 0) - number(event.start, 0)) * 100));
  const weights = segments.map((segment) => Math.max(0.01,
    number(segment.durationMs, number(segment.duration, 1) * (segment.durationMs == null ? 1 : 0.001))
  ));
  const weightTotal = weights.reduce((sum, value) => sum + value, 0);
  let remaining = totalCentiseconds;
  const highlight = `${assColor(theme.highlight, '&H0042B9F4')}&`;
  const pending = `${assColor(theme.karaokePending, '&H00D3D6DC')}&`;
  const text = segments.map((segment, index) => {
    const duration = index === segments.length - 1
      ? Math.max(1, remaining)
      : Math.max(1, Math.round(totalCentiseconds * weights[index] / weightTotal));
    remaining -= duration;
    return `{\\kf${duration}}${escapePlain(segment.text)}`;
  }).join('');
  return `{\\1c${highlight}\\2c${pending}}${text}`;
}

function expandCues(cues, options = {}) {
  const events = [];
  for (const cue of cues || []) {
    const common = {
      start: cue.start,
      end: cue.end,
      pos: cue.pos
    };
    if (cue.english) events.push({ ...common, layer: 2, style: cue.englishStyle || 'English', text: cue.english });
    if (cue.chinese) events.push({ ...common, layer: 1, style: cue.chineseStyle || 'Chinese', text: cue.chinese });
    if (cue.note) events.push({ ...common, layer: 0, style: cue.noteStyle || 'Note', text: cue.note });
    if (cue.source && options.showSource === true) events.push({ ...common, layer: 3, style: 'Source', text: cue.source });
  }
  return events;
}

function styleValues(document, options) {
  const width = Math.max(320, Math.round(number(options.width, 1080)));
  const height = Math.max(240, Math.round(number(options.height, 1920)));
  const scale = height / 1920;
  const horizontalScale = Math.min(1.2, Math.max(0.72, width / 1080));
  const typeScale = Math.min(scale, horizontalScale);
  const size = (base, minimum = 20) => Math.max(minimum, Math.round(base * typeScale));
  const margin = (ratio, minimum = 20) => Math.max(minimum, Math.round(height * ratio));
  // TikTok's official 720x1280 in-feed LTR template marks 80 px left,
  // 120 px right, 160 px top, and 440 px bottom as UI risk areas.
  // Scale those asymmetric horizontal bounds to the active canvas.
  const safeLeft = Math.max(48, Math.round(width * (80 / 720)));
  const safeRight = Math.max(48, Math.round(width * (120 / 720)));
  const fonts = document.fonts || {};
  const font = fontFamily(document.font || options.font || 'Noto Sans CJK SC');
  const englishFont = fontFamily(fonts.english || font);
  const chineseFont = fontFamily(fonts.chinese || font);
  const titleFont = fontFamily(fonts.title || chineseFont);
  const theme = document.theme || {};
  const primary = assColor(theme.primary, '&H00FFFFFF');
  const secondary = assColor(theme.secondary, '&H00E8E2D8');
  const outline = assColor(theme.outline, '&HCC101010');
  const back = assColor(theme.back, '&H70000000');

  return {
    English: [englishFont, size(88, 38), primary, outline, back, 1, 0.4, 5, 1, 2, safeLeft, safeRight, margin(500 / 1920)],
    Chinese: [chineseFont, size(72, 34), secondary, outline, back, 1, 0.2, 4, 0, 2, safeLeft, safeRight, margin(360 / 1920)],
    Note: [titleFont, size(76, 34), assColor(theme.note, '&H00FFFFFF'), '&H99101010', '&H60000000', 1, 1.2, 4, 1, 8, safeLeft, safeRight, margin(560 / 1920)],
    Source: [font, size(46, 24), assColor(theme.source, '&H00C1C7C9'), '&HAA101010', '&H60000000', 0, 0.3, 3, 0, 7, safeLeft, safeRight, margin(280 / 1920)],
    Card: [font, size(76, 32), primary, outline, '&H80000000', 1, 1, 4, 1, 5, safeLeft, safeRight, 0],
    CardChinese: [font, size(46, 24), secondary, outline, '&H80000000', 0, 0.3, 3, 0, 5, safeLeft, safeRight, 0],
    BigWord: [font, size(106, 42), primary, outline, '&H85000000', 1, 1.4, 5, 1, 5, safeLeft, safeRight, 0],
    BigChinese: [font, size(50, 26), secondary, outline, '&H85000000', 0, 0.3, 3, 0, 5, safeLeft, safeRight, 0]
  };
}

function styleLine(name, values) {
  const [font, fontSize, primary, outline, back, bold, spacing, outlineWidth, shadow, alignment, marginL, marginR, marginV] = values;
  return `Style: ${name},${font},${fontSize},${primary},&H000000FF,${outline},${back},${bold},0,0,0,100,100,${spacing},0,1,${outlineWidth},${shadow},${alignment},${marginL},${marginR},${marginV},1`;
}

function header(document, options = {}) {
  const width = Math.max(320, Math.round(number(options.width, 1080)));
  const height = Math.max(240, Math.round(number(options.height, 1920)));
  const styles = styleValues(document, { ...options, width, height });
  const styleLines = STYLE_ORDER.map((name) => styleLine(name, styles[name]));
  return `[Script Info]
Title: ${escapePlain(document.title || 'QiaoCut bilingual captions')}
ScriptType: v4.00+
PlayResX: ${width}
PlayResY: ${height}
WrapStyle: 0
ScaledBorderAndShadow: yes
YCbCr Matrix: TV.709

[V4+ Styles]
Format: Name, Fontname, Fontsize, PrimaryColour, SecondaryColour, OutlineColour, BackColour, Bold, Italic, Underline, StrikeOut, ScaleX, ScaleY, Spacing, Angle, BorderStyle, Outline, Shadow, Alignment, MarginL, MarginR, MarginV, Encoding
${styleLines.join('\n')}

[Events]
Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text
`;
}

function eventLine(event, document = {}) {
  const style = STYLE_ORDER.includes(event.style) ? event.style : 'English';
  const theme = document.theme || {};
  const animation = animationType(event);
  const tags = [];
  if (animation !== 'none') {
    tags.push(`\\fad(${Math.max(0, Math.round(number(event.fadeInMs, 120)))},${Math.max(0, Math.round(number(event.fadeOutMs, 140)))})`);
  }
  const width = Math.max(320, Math.round(number(document.width, 1080)));
  const height = Math.max(240, Math.round(number(document.height, 1920)));
  const coordinateWidth = Math.max(1, number(document.coordinateWidth, width));
  const coordinateHeight = Math.max(1, number(document.coordinateHeight, height));
  const coordinateScaleX = width / coordinateWidth;
  const coordinateScaleY = height / coordinateHeight;
  if (style === 'BigWord') tags.push(`\\pos(${Math.round(width / 2)},${Math.round(height * 0.469)})`);
  if (style === 'BigChinese') tags.push(`\\pos(${Math.round(width / 2)},${Math.round(height * 0.547)})`);
  if (style === 'Card') tags.push(`\\pos(${Math.round(width / 2)},${Math.round(height * 0.453)})`);
  if (style === 'CardChinese') tags.push(`\\pos(${Math.round(width / 2)},${Math.round(height * 0.526)})`);
  if (Array.isArray(event.pos) && event.pos.length === 2) {
    const x = Math.round(number(event.pos[0], coordinateWidth / 2) * coordinateScaleX);
    const y = Math.round(number(event.pos[1], coordinateHeight / 2) * coordinateScaleY);
    const slideOffset = Math.max(1, Math.round(42 * coordinateScaleY));
    if (animation === 'slide-up') tags.push(`\\move(${x},${y + slideOffset},${x},${y},0,220)`);
    else tags.push(`\\pos(${x},${y})`);
  }
  if (animation === 'pop') {
    tags.push('\\fscx72\\fscy72\\t(0,180,\\fscx100\\fscy100)');
  }
  const body = animation === 'karaoke' || animation === 'word-follow' || animation === 'typewriter'
    ? karaokeText(event, theme)
    : renderText(event.text, style, `${assColor(theme.highlight, '&H0042B9F4')}&`);
  const text = `{${tags.join('')}}${body}`;
  return `Dialogue: ${Math.round(number(event.layer, 0))},${assTime(event.start)},${assTime(event.end)},${style},,0,0,0,,${text}`;
}

function validateEvents(events) {
  const animations = new Set(['fade', 'none', 'pop', 'slide-up', 'karaoke', 'word-follow', 'typewriter']);
  for (const [index, event] of events.entries()) {
    const start = number(event.start, NaN);
    const end = number(event.end, NaN);
    if (!Number.isFinite(start) || !Number.isFinite(end) || start < 0 || end <= start) {
      throw new Error(`Caption event ${index + 1} must have finite start/end with 0 <= start < end.`);
    }
    if (typeof event.text !== 'string' || !event.text.trim()) {
      throw new Error(`Caption event ${index + 1} has no text.`);
    }
    const animation = animationType(event);
    if (!animations.has(animation)) throw new Error(`Caption event ${index + 1} has unsupported animation: ${animation}.`);
    if (event.segments != null) {
      if (!Array.isArray(event.segments) || event.segments.length === 0) {
        throw new Error(`Caption event ${index + 1} segments must be a non-empty array.`);
      }
      for (const segment of event.segments) {
        if (!segment || typeof segment.text !== 'string' || !segment.text) {
          throw new Error(`Caption event ${index + 1} contains an invalid segment.`);
        }
      }
    }
  }
}

function generateBilingualAss(document, options = {}) {
  if (!document || typeof document !== 'object' || Array.isArray(document)) {
    throw new Error('Caption JSON must be an object with events or cues.');
  }
  const events = [
    ...(Array.isArray(document.events) ? document.events : []),
    ...expandCues(Array.isArray(document.cues) ? document.cues : [], document)
  ];
  validateEvents(events);
  const renderingDocument = {
    ...document,
    font: options.font || document.font,
    width: number(options.width, document.width || 1080),
    height: number(options.height, document.height || 1920),
    coordinateWidth: number(options.coordinateWidth, document.coordinateWidth || document.width || options.width || 1080),
    coordinateHeight: number(options.coordinateHeight, document.coordinateHeight || document.height || options.height || 1920)
  };
  return header(renderingDocument, renderingDocument) + events.map((event) => eventLine(event, renderingDocument)).join('\n') + '\n';
}

function readCaptionDocument(file) {
  return JSON.parse(fs.readFileSync(file, 'utf8'));
}

function main(argv = process.argv.slice(2)) {
  const [input, output, width, height] = argv;
  if (!input || !output) {
    process.stderr.write('Usage: bilingual_ass.js captions.json subtitles.ass [width] [height]\n');
    process.exitCode = 2;
    return;
  }
  const document = readCaptionDocument(path.resolve(input));
  const ass = generateBilingualAss(document, { width, height });
  const absoluteOutput = path.resolve(output);
  fs.mkdirSync(path.dirname(absoluteOutput), { recursive: true });
  fs.writeFileSync(absoluteOutput, ass, 'utf8');
  process.stdout.write(`${absoluteOutput}\n`);
}

module.exports = {
  STYLE_ORDER,
  assTime,
  escapePlain,
  expandCues,
  generateBilingualAss,
  karaokeText,
  readCaptionDocument,
  renderText
};

if (require.main === module) {
  try {
    main();
  } catch (error) {
    process.stderr.write(`${error.message}\n`);
    process.exitCode = 1;
  }
}
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