Communitygithub.com

VidTSX 2D 视频生成器

根据镜头、场景或视频描述,生成可用于 VidTSX(基于 Remotion)的生产级 2D TSX 视频文件。

VidTSX 2D 视频生成器 是什么?

该技能用于根据用户的镜头、场景描述或视觉动画需求,自动生成符合 VidTSX 规范的生产级 2D TSX 视频文件。它支持多种尺寸预设(横屏、竖屏、方形)和六种风格预设(极简、孟菲斯、新粗野主义、玻璃拟态、霓虹赛博朋克、企业风),并内置严格的正确性规则确保渲染不出错。此技能适用于 Claude Code、Cursor、Codex 等 AI 开发工具,用户只需描述想要的动画效果,AI 即可生成可直接编辑的 .tsx 文件。其工作原理基于 Remotion 的逐帧渲染模型,严格遵循帧动画规则(仅使用 useCurrentFrame 和 interpolate,禁止 useState/useEffect/setTimeout),并强制执行 Easing.bezier 语法、chroma-js 命名空间导入等硬性约束。该技能不适用于 3D 场景、普通 React 开发或直接编辑视频文件。

兼容平台~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/raisaksham377-bot/youtube-shorts-ai-editor/tree/HEAD/.claude/skills/vidtsx-2d-generator

在你喜欢的 AI 中提问

打开一个已预加载此 Agent Skill 的新对话。

文档

VidTSX 2D 视频生成器 是做什么的?

根据镜头或视频描述,生成可用于 VidTSX 的生产级 2D TSX 视频文件。这些文件是 Remotion 合成组件,VidTSX 会逐帧渲染,因此正确性比巧妙更重要:单个非单调的 interpolate 范围或一个多余的 useState 都会导致渲染崩溃。

此技能涵盖 2D 动态图形。3D 工作(@remotion/three / React Three Fiber)不在范围内。

如何使用此技能

  1. 明确的单一镜头 → 直接生成 .tsx 文件。
  2. 复杂、多镜头或视觉不明确的请求 → 先简短确认镜头分解或视觉方向,然后再生成。不要过度询问,一行确认即可。
  3. 以实际的 .tsx 文件形式交付,而不是内联代码。这些 TSX 组件始终超过 20 行,用户会直接编辑这些文件。默认 每个文件一个镜头(原子化,易于编辑),除非用户要求单个组合交付物。
  4. 文件仅包含 组件代码 —— 欢迎使用下面结构化的段落注释,但文件中不要有 markdown 围栏或文字说明。
  5. 渲染并查看后再结束 —— 请参阅 验证渲染。仅凭推理的镜头不算完成;静态图像(对于渐显/滚动,还需在每个关键点渲染帧)是完成的标准。

输出规范

尺寸预设

格式宽度高度用途
横屏19201080YouTube, 演示文稿
竖屏10801920TikTok, Reels, Shorts
方形10801080Instagram 动态

默认值

  • 格式: 横屏 (1920×1080)
  • 时长: 5 秒
  • 帧率: 30
  • 风格: 极简 (参见 references/style-presets.md)

强制文件结构

每个生成的文件都遵循此骨架。带标签的段落注释是有意为之 —— 它们使大文件易于导航。

import React from 'react';
import {
  useCurrentFrame,
  useVideoConfig,
  interpolate,
  Easing,
  AbsoluteFill,
  Sequence,
} from 'remotion';

// =============================================================================
// 合成配置
// =============================================================================
export const compositionConfig = {
  id: 'ComponentName', // 仅限帕斯卡命名法 —— 不能有连字符或下划线
  durationInSeconds: 5,
  fps: 30,
  width: 1920,
  height: 1080,
};

// =============================================================================
// 样式常量
// =============================================================================
const COLORS = {
  primary: '#6366f1',
  secondary: '#8b5cf6',
  accent: '#06b6d4',
  background: '#0f0f23',
  text: '#ffffff',
} as const;

const TYPOGRAPHY = {
  fontFamily: 'Inter, system-ui, sans-serif',
} as const;

const EASINGS = {
  easeOut: Easing.bezier(0.33, 1, 0.68, 1),
  easeIn: Easing.bezier(0.32, 0, 0.67, 0),
  easeInOut: Easing.bezier(0.37, 0, 0.63, 1),
  overshoot: Easing.bezier(0.34, 1.56, 0.64, 1),
} as const;

// =============================================================================
// 预生成数据(在模块级别计算一次,渲染期间不计算)
// =============================================================================
const seededRandom = (seed: number): number => {
  const x = Math.sin(seed * 9999) * 10000;
  return x - Math.floor(x);
};

// =============================================================================
// 主组件
// =============================================================================
const ComponentName: React.FC = () => {
  const frame = useCurrentFrame();
  const { fps, durationInFrames, width, height } = useVideoConfig();

  return (
    <AbsoluteFill style={{ backgroundColor: COLORS.background }}>
      {/* 内容 */}
    </AbsoluteFill>
  );
};

export default ComponentName;

将 ComponentName 替换为描述镜头的帕斯卡命名法名称,根据所选风格预设设置 COLORS 块,并根据请求设置 width / height / durationInSeconds / fps。


正确性规则

这些不是风格偏好 —— 它们是渲染成功的关键。VidTSX(通过 Remotion)在固定的帧号下调用组件来渲染每一帧。没有事件循环,帧之间没有持久性,也没有挂钟时间。任何假设这些东西的写法都会出错。

动画始终基于帧

  • 所有动画都通过 useCurrentFrame() + interpolate() 驱动。
  • 切勿使用 useState、useEffect、setTimeout、setInterval 或 CSS 动画/过渡。它们不适用于逐帧模型,会产生损坏或非确定性的输出。
  • 对于随机或程序化内容,使用 seededRandom(或等效的种子函数),以便给定帧的每次渲染都相同。在模块级别预生成粒子/随机数组,切勿在渲染函数内部 —— 每帧重新计算会导致闪烁。
  • 交错动画,使元素按顺序进入,而不是同时出现。这样视觉效果更好,也是预期的外观。

interpolate — 输入范围必须严格递增

interpolate 的输入范围必须严格单调递增。重复或递减的值会在运行时抛出错误。

// ✅ 正确
interpolate(frame, [0, 30, 60], [0, 1, 0]);

// ❌ 抛出错误 —— 输入范围递减
interpolate(frame, [60, 30, 0], [0, 1, 0]);

要反转映射,请翻转输出范围,切勿翻转输入范围:

// ✅ 正确 —— 映射 0→100, 1→0
interpolate(value, [0, 1], [100, 0]);

// ❌ 错误
interpolate(value, [1, 0], [100, 0]);

对于基于索引的时间控制,确保 startFrame < endFrame 并始终进行钳制:

const startFrame = index * 30;
const endFrame = startFrame + 30;
interpolate(frame, [startFrame, endFrame], [0, 1], {
  extrapolateLeft: 'clamp',
  extrapolateRight: 'clamp',
});

始终传递 extrapolateLeft: 'clamp' 和 extrapolateRight: 'clamp',除非确实需要无界值 —— 没有它们,值会在关键帧前后超出其范围。

Easing — 使用 Easing.bezier(),切勿使用包装器语法

Easing.out(Easing.cubic) 等包装形式会崩溃。一次性定义命名贝塞尔曲线(请参阅骨架中的 EASINGS 块)并引用它们:

// ❌ 会崩溃
Easing.out(Easing.cubic);
Easing.in(Easing.quad);

// ✅ 正确
interpolate(frame, [0, 30], [0, 1], {
  easing: EASINGS.easeOut,
  extrapolateRight: 'clamp',
});

chroma-js — 仅限命名空间导入

// ✅ 正确
import * as chroma from 'chroma-js';
const color = chroma('#00bfff').brighten(0.5).hex();

// ❌ 错误 —— "chroma is not a function"
import chroma from 'chroma-js';

@remotion/paths — 只存在真实的函数

这些辅助函数不存在,绝不能使用: makeCircle()、makeRect()、makeTriangle()、makeLine()、makePie()、makePolygon()、makeEllipse()、makeStar()。

只有这些导入是有效的:

import { evolvePath, getLength, getPointAtLength, getTangentAtLength } from '@remotion/paths';

手动编写 SVG 路径字符串,并使用 evolvePath 为它们添加动画:

const circlePath = 'M 50 10 A 40 40 0 1 1 49.99 10 Z';
const rectPath = 'M 0 0 L 100 0 L 100 50 L 0 50 Z';
const linePath = 'M 0 0 L 100 100';

const { strokeDasharray, strokeDashoffset } = evolvePath(progress, rectPath);

合成 ID

compositionConfig.id 必须仅限帕斯卡命名法 —— 不能有连字符或下划线(例如 ProductReveal,而不是 product-reveal 或 product_reveal)。


布局

安全区域

  • 顶部 10%: 为平台 UI 保留。
  • 底部 15%: 为字幕/按钮保留。
  • 主要内容保持在垂直方向的 25%–75% 之间。

居中辅助

const centered: React.CSSProperties = {
  position: 'absolute',
  top: '50%',
  left: '50%',
  transform: 'translate(-50%, -50%)',
};

排版

元素大小字重
标题72–120px700–900
副标题36–48px500–700
正文28–36px400–500

始终在文本元素上设置 margin: 0 —— 浏览器默认值会使布局偏离中心。


风格预设

当用户指定风格时,从 references/style-presets.md 加载其调色板和特征,并将 COLORS 对象放入骨架中。六种预设是:极简(默认)、孟菲斯、新粗野主义、玻璃拟态、霓虹/赛博朋克和企业风。如果未指定风格,则使用极简风格。


验证渲染(请勿跳过)

只有在你看过之后,镜头才算完成。编写完 .tsx 后,至少渲染一个静态图像并打开它 —— 切勿交付仅凭推理的镜头。渲染成功且数值正确,但文本溢出其卡片、图像裁剪错误、元素在屏幕外或两个元素重叠,只有屏幕截图才能捕获这些问题。

  • 渲染一个静态图像(例如 node scripts/render-all.mjs --still --scale=1 <ShotId>)并查看 PNG。
  • 对于基于时间的渐显(元素在特定时刻进入、滚动、分阶段),单个 60% 时长位置的静态图像是不够的 —— 渲染完整片段并在每个关键时刻提取帧(ffmpeg -ss <t> -i out/<id>.mp4 -frames:v 1 f.jpg),或在多个偏移位置渲染静态图像。验证每个关键点的状态,而不仅仅是一帧。
  • 特别检查:图像适合其插槽(没有重要内容被裁剪;对于异质真实图像,倾向于在匹配背景上使用 objectFit: contain),文本未被裁剪或溢出,没有内容超出安全区域,并且每个动画元素在应该可见时确实可见。
  • 如果要与其他素材合成,还要抽查最终导出输出中的一帧,而不仅仅是孤立的镜头。

修复屏幕截图揭示的问题,然后重新渲染并再次查看。将以“我渲染了它,看起来正确”——并附上显示的帧——视为完成的标准。


最终输出

生成完整的 .tsx 文件,且文件内不要包含其他内容 —— 文件本身内不要有外围的 markdown,代码前后不要有注释说明。在聊天中交付文件时,附带简短的一行说明是可以的。

Individual skills in this repo

This repo contains 8 individual skills — each has its own dedicated page.

raisaksham377-bot/youtube-shorts-ai-editor

Makes this repo's videos look like YOUR channel instead of the house default — interviews you for palette, fonts, wordmark, motion energy, delivery specs and SFX taste, then rewrites brand.md + remotion/src/brand.ts + remotion/src/fonts.ts together and renders a proof card so you SEE it. Use whenever the user wants to set up or change their brand, rebrand the repo, "make it my colors/fonts", change the accent color, set their wordmark, adjust the motion feel, or asks why their videos look like someone else's. Run it once before the first video. Not for per-video art direction (that is /make-tsx) and not for thumbnails, which are deliberately louder than the brand (that is /packaging).

raisaksham377-bot/youtube-shorts-ai-editor

Build a split-frame vertical Short/Reel (1080x1920) from talking-head footage — real face cropped into the bottom half throughout, bespoke motion-graphic beats + word-by-word captions in the top half. Use when the user wants a "vertical short", "reel", "9:16 video", "split-frame" format, asks to keep their face on screen the whole time while graphics play above it, wants an in-context app/UI mockup moment (like clicking a button in a browser) without cutting away from their face, or hits caption-pill-covers-my-face / no-GPU-rendering / audio-duration-mismatch problems while building one. Covers the crop-offset technique for framing the face, the caption-pill safe zone, the top-half-only UI-mockup scene pattern, the full pipeline from raw footage to final SFX mix, and the environment gotchas (no NVIDIA GPU, AAC priming gap, comp-native transcode). Topic-agnostic — this is a layout/technique skill, not tied to any one video's content. Builds on /clean-cut, /make-tsx conventions, and /suggest-sfx; doesn't rep...

raisaksham377-bot/youtube-shorts-ai-editor

Voice/audio cleanup step of the AI Video Editor pipeline — diagnose a video's background noise, pick the right denoise method, and produce a cleaned master (voice isolated, levels preserved, video stream copied). Use when the user wants to "clean the audio / voice", "remove background noise", "denoise", "isolate voice", fix outdoor/room/water/hum/hiss noise, run ElevenLabs Voice Isolator or local RNNoise, A/B denoise methods, or produce a cleaned master for a video-N in this repo. Covers diagnosing the noise (spectrogram + levels), choosing eleven vs rnnoise by noise type, the sample A/B, tools/clean_voice.py, preserving levels (RMS-match, not LUFS), and rewiring the pipeline to the clean master. Not the SFX/music mix (that is /suggest-sfx + the final-mix step) and not the cut (that is /clean-cut).

raisaksham377-bot/youtube-shorts-ai-editor

Step 1 of the AI Video Editor pipeline — turn raw talking-head footage into a clean master cut. Use when the user wants to "clean cut", "cut the raw footage", "remove filler / dead air / bad takes", "tighten the pacing", produce cuts.json, run the cut editor, or render a cleaned preview/master for a video-N project in this repo. Covers audio extraction, AssemblyAI transcription, authoring cuts.json (keeps/cuts/fluff categorized), the cut policy (content-aggressive, pause-natural ~0.5s), QA + review docs, the local cut-editor UI, tight/natural previews, the final 4K60 render, and producing edited-transcript.json as the handoff to /make-tsx. Not for building TSX overlays (that is /make-tsx) or the raw TSX authoring rules (that is vidtsx-2d-generator).

raisaksham377-bot/youtube-shorts-ai-editor

Turn static SCREENSHOTS into a simulated screen recording (TSX) — a fake screencast with an animated cursor that eases to targets and clicks, a browser URL bar that updates per page, hard-cut navigations, in-page filter crossfades, smooth scroll, and a ken-burns zoom onto the payoff. Use when a beat needs to show a walkthrough of a web app / dashboard / settings page and you'd rather build it from screenshots than get (or ask for) a real screen recording — "fake a screen recording", "turn these screenshots into a screencast", "simulate clicking through the dashboard", "animate this UI walkthrough", "cursor moving through the app". Built on remotion/src/lib/screencast.tsx. This is a technique WITHIN step 2 (make-tsx): defer timeline/render/bake orchestration to make-tsx and raw crash-free TSX rules to vidtsx-2d-generator. Not for a single static page clone (use WebBrowserFrame directly) and not when the point is genuine proof of real speed/output (use a real recording).

raisaksham377-bot/youtube-shorts-ai-editor

Step 2 of the AI Video Editor pipeline — build the visual beats (Remotion TSX shots) over a project's master cut and bake a composited preview. Use when the user wants to add/edit overlays or full-screen animation segments, "make a shot / beat", implement an edit plan or a v2 update, retime a beat to the narration, re-render shots, or re-bake the video-N preview in this repo. Covers reading the plan + edited-transcript + brand + reusable kit, authoring shots library-first, syncing reveals to word times, updating timeline.json (cutaway vs overlay), rendering, verifying by screenshot, and baking with tools/bake.py. Defers raw TSX authoring rules to vidtsx-2d-generator and the cut itself to clean-cut.

raisaksham377-bot/youtube-shorts-ai-editor

Generates click-optimized YouTube packaging — 3 thumbnail bets under one fixed title, engineered for YouTube's built-in A/B/C thumbnail test, plus a value-forward description, then renders the thumbnails as real images. Use this whenever you want to package a long-form video or turn a video idea into titles and thumbnails. Triggers include how would you package this, title ideas for, thumbnail concept, package this video, A/B variations, and make this clickable. Calibrates to your channel's own CTR data if you have it. Long-form only, never Shorts. Not for non-YouTube copywriting.

raisaksham377-bot/youtube-shorts-ai-editor

Step 4 of the AI Video Editor pipeline — the SFX pass. Analyze a video's beats + narration and propose tasteful sound effects synced to them, drawing from (and growing) a shared, reusable SFX library, then render an SFX-mixed audition preview. Use when the user wants to "add SFX / sound effects", "suggest sfx", "score the transitions", "sound-design this beat", generate/source sound effects, build or extend the sfx library/catalog, author or audit a sfx-plan, or mix SFX over a video-N preview in this repo. Covers reading timeline + edited-transcript + brand §10, the library-first flow, generating misses with the ElevenLabs Sound Effects API, the per-video sfx-plan.json, the hard user-audit gate, and mixing with tools/mix_sfx.py (light voice ducking). Not the music bed (that is the final-mix step) and not the visual beats (that is /make-tsx).

相关技能