Communitygithub.com

TerminalSkills/skills

使用 React 和 Remotion 以程式化方式建立影片。當使用者要求用程式碼建立影片、產生個人化影片、建置動畫資料視覺化、新增 TikTok 風格字幕、以程式化方式渲染影片,或自動化影片製作時使用。支援 CLI 渲染、AWS Lambda 與 Google Cloud Run 部署。

skills 是什麼?

此技能提供完整的 Remotion 影片工具組,讓開發者能使用 React 元件以程式化方式建立、渲染與部署影片。它涵蓋專案初始化、自訂影片合成、動畫資料視覺化、TikTok 風格動態字幕,以及批次渲染,適合自動化社群媒體內容、個人化影片製作與動態資料儀表板。支援透過 CLI 進行本機渲染,並可擴展至 AWS Lambda 與 Google Cloud Run,實現雲端批次處理。使用者能充分運用 `useCurrentFrame()`、`interpolate()`、`spring()` 與 `<Sequence>` 等 Remotion 核心 API 建立流暢動畫,並將動態資料以 props 傳入以維持純元件,便於批次渲染。此外,技能也提供最佳實務指引,例如優先使用 `<OffthreadVideo>` 以獲得較佳效能,以及透過 `crf` 參數控制輸出品質。透過具體範例,例如個人化歡迎影片、季度銷售儀表板動畫,以及社群媒體字幕疊加,說明如何將這些功能整合至實際工作流程中。

相容平台✓Claude Code✓Codex CLI✓Cursor✓Gemini CLI
npx skills add https://github.com/TerminalSkills/skills/tree/HEAD/skills/remotion-video-toolkit

在你喜歡的 AI 中提問

開啟一個已預先載入此 Agent Skill 的新對話。

說明文件

Remotion 影片工具組

概述

使用 React 和 Remotion 以程式化方式建立影片。將可重複使用的影片範本建置為 React 元件,透過 CLI 或雲端基礎架構渲染為 MP4/WebM 格式,並可大規模產生個人化影片。此工具非常適合自動化的社群媒體內容、動畫資料視覺化,以及動態影片生產管線。

指示

當使用者要求建立程式化影片時,判斷任務:

任務 A:設定 Remotion 專案

# 建立新的 Remotion 專案
npx create-video@latest my-video
cd my-video
npm start  # 在 http://localhost:3000 開啟 Remotion Studio

專案結構:

my-video/
  src/
    Root.tsx          # 註冊所有合成
    MyComposition.tsx # 你的影片元件
  remotion.config.ts  # 渲染設定

任務 B:建立影片合成

每個 Remotion 影片都是一個使用 useCurrentFrame() 和 useVideoConfig() 的 React 元件:

import { AbsoluteFill, useCurrentFrame, useVideoConfig, interpolate, spring } from "remotion";

interface MyVideoProps {
  title: string;
  subtitle: string;
  bgColor: string;
}

export const MyVideo: React.FC<MyVideoProps> = ({ title, subtitle, bgColor }) => {
  const frame = useCurrentFrame();
  const { fps } = useVideoConfig();

  // 標題滑入動畫
  const titleY = spring({ frame, fps, from: -100, to: 0, durationInFrames: 30 });

  // 字幕在 20 幀後淡入
  const subtitleOpacity = interpolate(frame, [20, 40], [0, 1], {
    extrapolateRight: "clamp",
  });

  return (
    <AbsoluteFill style={{ backgroundColor: bgColor, justifyContent: "center", alignItems: "center" }}>
      <h1 style={{ fontSize: 80, color: "white", transform: `translateY(${titleY}px)` }}>
        {title}
      </h1>
      <p style={{ fontSize: 36, color: "rgba(255,255,255,0.8)", opacity: subtitleOpacity }}>
        {subtitle}
      </p>
    </AbsoluteFill>
  );
};

在 Root.tsx 中註冊合成:

import { Composition } from "remotion";
import { MyVideo } from "./MyVideo";

export const RemotionRoot: React.FC = () => {
  return (
    <Composition
      id="MyVideo"
      component={MyVideo}
      durationInFrames={150}
      fps={30}
      width={1920}
      height={1080}
      defaultProps={{ title: "Hello World", subtitle: "Made with Remotion", bgColor: "#1a1a2e" }}
    />
  );
};

任務 C:新增 TikTok 風格動態字幕

import { AbsoluteFill, useCurrentFrame, Sequence } from "remotion";

interface CaptionWord {
  text: string;
  startFrame: number;
  durationInFrames: number;
}

const captions: CaptionWord[] = [
  { text: "This", startFrame: 0, durationInFrames: 15 },
  { text: "is", startFrame: 15, durationInFrames: 10 },
  { text: "amazing!", startFrame: 25, durationInFrames: 20 },
];

export const CaptionOverlay: React.FC = () => {
  const frame = useCurrentFrame();

  const activeWord = captions.find(
    (c) => frame >= c.startFrame && frame < c.startFrame + c.durationInFrames
  );

  return (
    <AbsoluteFill style={{ justifyContent: "flex-end", alignItems: "center", paddingBottom: 120 }}>
      {activeWord && (
        <div style={{
          fontSize: 64,
          fontWeight: "bold",
          color: "white",
          textShadow: "2px 2px 8px rgba(0,0,0,0.8)",
          backgroundColor: "rgba(0,0,0,0.5)",
          padding: "8px 24px",
          borderRadius: 12,
        }}>
          {activeWord.text}
        </div>
      )}
    </AbsoluteFill>
  );
};

任務 D:渲染影片

# 透過 CLI 在本機渲染
npx remotion render MyVideo out/video.mp4

# 使用自訂 props 渲染
npx remotion render MyVideo out/video.mp4 --props='{"title":"Custom Title"}'

# 渲染單一幀(用於縮圖)
npx remotion still MyVideo out/thumbnail.png --frame=45

# 使用特定編解碼器和品質渲染
npx remotion render MyVideo out/video.mp4 --codec=h264 --crf=18

若要大量批次渲染:

# 在 AWS Lambda 上渲染
npx remotion lambda render MyVideo --props='{"title":"Video 1"}'

# 在 Google Cloud Run 上渲染
npx remotion cloudrun render MyVideo --props='{"title":"Video 1"}'

任務 E:動畫資料視覺化

import { AbsoluteFill, useCurrentFrame, interpolate } from "remotion";

interface DataPoint { label: string; value: number; color: string; }

export const BarChart: React.FC<{ data: DataPoint[] }> = ({ data }) => {
  const frame = useCurrentFrame();
  const maxVal = Math.max(...data.map((d) => d.value));

  return (
    <AbsoluteFill style={{ padding: 80, justifyContent: "flex-end", backgroundColor: "#0f0f23" }}>
      <div style={{ display: "flex", alignItems: "flex-end", gap: 20, height: "70%" }}>
        {data.map((point, i) => {
          const height = interpolate(frame, [i * 10, i * 10 + 30], [0, (point.value / maxVal) * 100], {
            extrapolateLeft: "clamp",
            extrapolateRight: "clamp",
          });
          return (
            <div key={i} style={{ flex: 1, textAlign: "center" }}>
              <div style={{
                height: `${height}%`,
                backgroundColor: point.color,
                borderRadius: "8px 8px 0 0",
                transition: "height 0.3s",
              }} />
              <p style={{ color: "white", marginTop: 12, fontSize: 24 }}>{point.label}</p>
            </div>
          );
        })}
      </div>
    </AbsoluteFill>
  );
};

範例

範例 1:個人化歡迎影片

使用者要求: "為每個新使用者產生附有他們名字的歡迎影片"

# 從 JSON 使用者清單產生影片
for user in $(jq -r '.[] | @base64' users.json); do
  name=$(echo "$user" | base64 -d | jq -r '.name')
  npx remotion render WelcomeVideo "out/welcome_${name}.mp4" \
    --props="{\"userName\":\"${name}\"}"
done

範例 2:動畫銷售儀表板

使用者要求: "建立一個影片,展示我們的季度指標逐個動畫呈現"

使用 BarChart 元件搭配季度資料建立合成,然後以以下指令渲染:

npx remotion render SalesDashboard out/q4_report.mp4 \
  --props='{"quarter":"Q4","revenue":1250000,"growth":12.5}'

範例 3:含字幕的社群媒體內容

使用者要求: "為 TikTok 的影片加入動態字幕"

將 CaptionOverlay 與 OffthreadVideo 來源結合:

import { OffthreadVideo } from "remotion";
<AbsoluteFill>
  <OffthreadVideo src="https://example.com/clip.mp4" />
  <CaptionOverlay />
</AbsoluteFill>

指南

  • 所有動畫都使用 useCurrentFrame() 和 interpolate();避免使用 CSS 轉場。
  • 保持合成元件的純粹性:將所有動態資料作為 props 傳遞,以便於批次渲染。
  • 使用 <Sequence> 來組織影片時間軸的區段。
  • 對於影片來源,優先使用 <OffthreadVideo> 而非 <Video>,以獲得較佳效能。
  • 設定 crf(Constant Rate Factor)在 16-20 之間,以獲得良好的品質與檔案大小比。
  • 若使用 Lambda 渲染,請將合成長度控制在 120 秒以內,以避免超時問題。
  • 在渲染之前先在 Remotion Studio 中測試,以便及早發現版面問題。
  • 使用 staticFile() 來參照 public/ 資料夾中的資源。

Individual skills in this repo

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

TerminalSkills/skills

>- Run GitHub Actions locally with act. Use when a user asks to test GitHub Actions workflows locally, debug CI pipelines without pushing, or run workflows offline.

TerminalSkills/skills

>- You are an expert in AG2 (formerly AutoGen), the open-source multi-agent conversation framework. You help developers build systems where multiple AI agents collaborate through structured conversations — with tool use, human-in-the-loop, code execution, group chat orchestration, and nested conversations — for complex tasks like software development, research, and data analysis.

TerminalSkills/skills

>- Generate short-form videos with AI — script writing, text-to-speech narration, stock footage selection, subtitle generation, and video assembly. Use when: creating TikTok/YouTube Shorts/Reels content, automating video production, building content pipelines.

TerminalSkills/skills

>- Animate 3D objects and characters in Blender with Python. Use when the user wants to keyframe properties, create armatures and rigs, set up IK/FK chains, animate shape keys for facial animation, edit F-Curves, use the NLA editor to blend actions, add drivers for expression-based animation, or script any animation workflow in Blender.

TerminalSkills/skills

>- Automate motion capture and tracking workflows in Blender with Python. Use when the user wants to import BVH or FBX mocap data, retarget motion to armatures, track camera or object motion from video, solve camera motion, clean up motion capture data, or script any tracking pipeline in Blender.

TerminalSkills/skills

>- You are an expert in Bolt.new by StackBlitz, the AI-powered full-stack development environment that runs entirely in the browser. You help developers go from idea to deployed app in minutes using natural language prompts — Bolt generates complete applications with frontend, backend, database, and deployment, all running in a WebContainer without local setup.

TerminalSkills/skills

>- Assists with using Bun as an all-in-one JavaScript/TypeScript runtime, package manager, bundler, and test runner. Use when building HTTP servers, managing packages, running tests, or migrating from Node.js. Trigger words: bun, bun serve, bun install, bun test, bun build, javascript runtime, bun runtime.

TerminalSkills/skills

>- Self-host customer support with Chatwoot. Use when a user asks to set up open-source customer support, add live chat without SaaS costs, build a multi-channel inbox, or deploy a free Intercom alternative.

TerminalSkills/skills

>- You are an expert in Chi, the lightweight, idiomatic Go HTTP router built on `net/http`. You help developers build composable HTTP services using Chi's middleware stack, route groups, URL parameters, sub-routers, and context-based request scoping — providing Express-like ergonomics while staying 100% compatible with Go's standard library.

TerminalSkills/skills

When the user wants to edit, review, or improve existing marketing copy. Also use when the user mentions 'edit this copy,' 'review my copy,' 'copy feedback,' 'proofread,' 'polish this,' 'make this better,' or 'copy sweep.' This skill provides a systematic approach to editing marketing copy through multiple focused passes.

TerminalSkills/skills

>- Add live chat and customer support with Crisp. Use when a user asks to add a chat widget, implement live customer support, set up a help desk, create a knowledge base, or add a chatbot to a website.

TerminalSkills/skills

>- Assists with building custom interactive data visualizations using D3.js. Use when creating charts, graphs, maps, force layouts, or hierarchical diagrams that require fine-grained control beyond what charting libraries provide. Trigger words: d3, data visualization, chart, svg, scales, force graph, treemap, choropleth.

TerminalSkills/skills

dbt (data build tool) transforms data in your warehouse using SQL SELECT statements. Learn project setup, models, tests, documentation, incremental materializations, and integration with data warehouses like PostgreSQL, BigQuery, and Snowflake.

TerminalSkills/skills

>- You are an expert in dlt, the open-source Python library for building data pipelines. You help developers load data from any API, file, or database into warehouses and lakes using simple Python decorators — with automatic schema inference, incremental loading, and built-in data contracts. dlt is the "requests library for data pipelines.

TerminalSkills/skills

Data Version Control for ML projects. Track large datasets and models alongside Git, build reproducible ML pipelines, and run experiments with metric comparison. Works with any storage backend including S3, GCS, Azure, and local filesystems.

TerminalSkills/skills

>- You are an expert in E2B, the cloud platform for running AI-generated code in secure sandboxes. You help developers give AI agents the ability to execute code, install packages, read/write files, and run long processes in isolated cloud environments — each sandbox is a lightweight VM that boots in ~150ms with full Linux, filesystem, and networking.

TerminalSkills/skills

>- Transcode, convert, edit, and process audio and video with FFmpeg. Use when a user asks to convert video formats (webm to mp4, mkv to mp4), extract audio from video, compress video files, trim or cut clips, concatenate videos, add subtitles, create thumbnails, apply filters, change resolution or bitrate, re-encode media, create GIFs from video, add watermarks, normalize audio, stream media, or build automated media processing pipelines.

TerminalSkills/skills

>- Create advanced animations with GSAP. Use when building complex timelines, scroll-driven animations, SVG morphing, text animations, or high-performance web animations beyond CSS capabilities.

TerminalSkills/skills

>- Generate deterministic MP4 videos from HTML, CSS, media, and seekable animations using HeyGen's HyperFrames framework. Use when someone asks to "render HTML to video", "make a video with HyperFrames", "create a programmatic video", "turn an animation into MP4", "build a launch/product video from HTML", "render GSAP/Lottie/Three.js to video", or set up an agent-driven video pipeline. Covers init/preview/render/add/lint/inspect commands, data-* timing attributes, animation adapters, and the component catalog.

TerminalSkills/skills

When the user wants to perform load testing, stress testing, or performance testing of APIs and websites using k6. Also use when the user mentions "k6," "load test," "performance test," "stress test," "spike test," "soak test," "thresholds," "virtual users," or "VUs." For browser-based testing, see selenium.

相關技能