Communitygithub.com

VidTSX 2D 影片產生器

根據鏡頭、場景或影片描述,產生可用於 VidTSX(基於 Remotion)的 2D TSX 影片檔案。每當使用者想建立或產生 VidTSX 影片、2D TSX 鏡頭或場景、動畫片段、標題卡或動態圖形時使用。

VidTSX 2D 影片產生器 是什麼?

這項技能專門用於從文字描述生成生產就緒的 2D TSX 影片檔案,這些檔案是 VidTSX 框架(基於 Remotion)的組成部分。它涵蓋了強制性的檔案結構、合成配置、尺寸預設(水平/垂直/正方形)以及六種風格預設(極簡、孟菲斯、新粗野主義、玻璃擬態、霓虹/賽博龐克、企業)。 為了確保渲染不崩潰,技能強制執行嚴格規則:僅使用基於影格的動畫(禁止 useState、useEffect、setTimeout),interpolate 的輸入範圍必須嚴格單調遞增,Easing 必須使用 Easing.bezier() 而不能使用包裝語法,以及 chroma-js 和 @remotion/paths 的特殊匯入陷阱。 支援的平台包括 Claude Code、Cursor 等 AI 代理工具,以及任何能夠讀取 SKILL.md 指令並產生符合規範的 TypeScript JSX (TSX) 程式碼的環境。使用者只需描述一個鏡頭或視覺動畫,AI 就會產生完整的 TSX 檔案,並附帶必要的註解和結構,方便使用者直接編輯。產出後必須透過渲染靜態影格來驗證,確保視覺效果正確,避免文字溢出、元素裁剪或重疊等問題。

相容平台~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 秒
  • FPS: 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).

相關技能