Communitygithub.com

tiantangcao1980-web/DesignDNA-Skills

Remotion — 「React で動画をプログラム的に作成する」 (43.6k スター、活発に開発中)。React コンポーネント、Props、CSS、Canvas、SVG を使って動画を作成できる React ベースのフレームワーク。説明動画、パーソナライズ広告、データ駆動型動画、GitHub Unwrapped 風コンテンツなど、プログラムによる動画生成に使用。インストール、コアコンセプト(Composition、frames、useCurrentFrame)、埋め込み用 Remotion Player、クラウドレンダリング用 Lambda などをカバー。

DesignDNA-Skills とは?

Remotion は、React を使ってプログラム的に動画を作成できる強力なフレームワークです。フレーム番号を基にした宣言的なアニメーションにより、CSS、SVG、Canvas、WebGL を駆使した複雑な動画を React コンポーネントとして記述できます。開発者は `useCurrentFrame()` や `interpolate()` などのフックを使用してピクセル単位の制御が可能で、最終的には FFmpeg によって MP4 などの動画ファイルにレンダリングされます。このフレームワークは個人開発者から大企業まで幅広いユースケースに対応しており、ローカルでのレンダリング、Remotion Player による React アプリへの埋め込み、AWS Lambda を使ったクラウドレンダリングなど、複数の出力方法を提供します。また、Remotion Studio を使ったインタラクティブなプレビューやタイムライン編集も可能で、データ駆動型のパーソナライズ動画(例:年間レビュー動画)の大量生成に特に適しています。ライセンスは小規模チーム(最大 10 人)までは無料で、大企業向けには有料プランが用意されています。

対応~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/tiantangcao1980-web/DesignDNA-Skills/tree/HEAD/designdna/skills/remotion

お気に入りのAIに質問する

このエージェントスキルを事前に読み込んだ状態で新しいチャットを開きます。

ドキュメント

Remotion — React で動画を作成する

出典: remotion-dev/remotion · 43.6k ⭐ · v4.x · 🟢 アクティブ 2026 NPM: remotion · @remotion/cli · @remotion/player · @remotion/lambda ドキュメント: https://www.remotion.dev/

1. コアとなる考え方

  • 動画とは、フレームごとにレンダリングされる React コンポーネントのシーケンスです
  • フレーム番号(0 → N)と空白のキャンバスが与えられ、あとは CSS / SVG / Canvas / WebGL で自由に描画します
  • Remotion は React を一連の PNG/JPEG フレームにコンパイルし、FFmpeg を介して MP4 にエンコードします

2. 使用すべき場面

  • プログラムによる動画生成(説明動画、パーソナライズ動画広告、データ駆動型動画)
  • 年間レビュー / 統計動画(GitHub Unwrapped、Spotify Wrapped のようなもの)
  • テキストとデータから構築するマーケティング説明動画(AE/Premiere で手動編集しない)
  • コードから生成される開発者ツール / チュートリアル動画

使用すべきでない場面

  • 実写動画の編集(Premiere / Final Cut を使用)
  • 従来のモーショングラフィックス(After Effects の方が効率的)
  • 単発の動画 — オーバーヘッドに見合わない

3. インストール(新規プロジェクト)

npx create-video@latest my-video
cd my-video
npm install
npm start  # Remotion Studio が起動します

提供されるテンプレート

  • Hello World
  • TypeScript
  • JavaScript
  • React 18 / 19
  • Audiogram
  • Stargazer(GitHub スターアニメーション)
  • Three.js
  • Empty

既存プロジェクトに追加する場合

npm install remotion @remotion/cli

src/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' }}
    />
  );
};

remotion.config.ts でルートを登録:

import { Config } from '@remotion/cli/config';
Config.setEntryPoint('./src/index.ts');

4. コアコンセプト

<Composition />

動画を定義します: どのコンポーネントをレンダリングするか、再生時間、fps、解像度、デフォルトのプロパティなど。

useCurrentFrame()

現在のフレーム番号(0 から始まる)を返します。すべてのアニメーションはこれに基づきます:

import { useCurrentFrame, useVideoConfig, interpolate } from 'remotion';

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

  const opacity = interpolate(frame, [0, 30], [0, 1], { extrapolateRight: 'clamp' });

  return (
    <div style={{ flex: 1, backgroundColor: '#0a0a0f', color: 'white', opacity, display: 'flex', alignItems: 'center', justifyContent: 'center' }}>
      <h1 style={{ fontSize: 120 }}>{title}</h1>
    </div>
  );
};

interpolate(frame, [from, to], [startVal, endVal], options)

フレーム番号を任意の値(位置、不透明度、スケール、色など)にマッピングします。

spring(...)

自然な動きのカーブ:

import { spring, useCurrentFrame, useVideoConfig } from 'remotion';

const frame = useCurrentFrame();
const { fps } = useVideoConfig();

const scale = spring({
  frame,
  fps,
  config: { damping: 100, stiffness: 200, mass: 0.5 },
});

<div style={{ transform: `scale(${scale})` }}>Content</div>

<Sequence from={f} durationInFrames={n}>

コンポーネントをフレーム f から開始するようにオフセットします:

import { Sequence } from 'remotion';

<Sequence from={0} durationInFrames={60}><Intro /></Sequence>
<Sequence from={60} durationInFrames={120}><Scene1 /></Sequence>
<Sequence from={180} durationInFrames={90}><Outro /></Sequence>

<Audio src={...} />

import { Audio } from 'remotion';
import bgMusic from './music.mp3';

<Audio src={bgMusic} volume={0.5} />

<Img src={...} /> / <Video src={...} />

画像 / 動画クリップをタイムラインに埋め込みます。

staticFile('...')

public/ 内のファイルを参照します — Remotion がパス解決を処理します:

import { staticFile } from 'remotion';
<Img src={staticFile('logo.svg')} />

5. レンダリング

ローカルレンダリング(CLI)

npx remotion render MyVideo out/video.mp4
npx remotion render MyVideo out/video.mp4 --props='{"title":"Hello"}'
npx remotion render MyVideo out/video.mp4 --quality=high --codec=h265

Remotion Studio(プレビュー+タイムライン)

npm start  # http://localhost:3000 が開きます

Remotion Player(React アプリに埋め込む)

import { Player } from '@remotion/player';
import { MyVideo } from './MyVideo';

<Player
  component={MyVideo}
  durationInFrames={150}
  fps={30}
  compositionWidth={1920}
  compositionHeight={1080}
  inputProps={{ title: 'Hello' }}
  controls
  style={{ width: '100%' }}
/>

Remotion Lambda(クラウドレンダリング)

バッチ / サーバーサイドレンダリング向け:

npm install @remotion/lambda

AWS Lambda 関数をセットアップし、Remotion をデプロイ:

npx remotion lambda functions deploy
npx remotion lambda sites create
npx remotion lambda render MyVideo --input-props='{"title":"User 123"}'

6. 例 — データ駆動型動画

パーソナライズされた「年間レビュー」動画を生成:

import { Composition } from 'remotion';
import { YearInReview } from './YearInReview';

export const RemotionRoot = () => (
  <Composition
    id="Recap"
    component={YearInReview}
    durationInFrames={8 * 30}   // 30fps で 8 秒
    fps={30}
    width={1080}
    height={1920}                 // 縦向き(スマホ)
    defaultProps={{
      user: { name: 'Alice', stats: { commits: 1284, prs: 42, reviews: 89 } },
    }}
  />
);

各ユーザーに対してレンダリング:

for user in $(cat users.json); do
  npx remotion lambda render Recap --input-props="$user"
done

7. 料金 / ライセンス

階層対象価格
個人 / チーム 3 人以下個人、小規模企業無料(MIT ライセンスに準ずる)
従業員 10 人以下の企業小規模スタートアップ無料
より大規模な企業従業員 10 人超$100/月 + $25/シート
Editor StarterRemotion を使って独自の動画エディタを構築$600 一括払い
Lambdaクラウドレンダリングレンダリングごとに支払い(動画 1 分あたり数セント程度)

公式条件については https://www.remotion.dev/docs/license を参照してください。

8. 禁止事項

  • ❌ Remotion をリアルタイム動画再生エンジンに決して使用しないでください — ファイルへのレンダリング用に設計されており、ライブストリーミング用ではありません
  • ❌ バンドルに 100MB を超える実際の動画ファイルを決して含めないでください — 大きなメディアは staticFile() を使って別途ホスティングしてください
  • ❌ Remotion コンポーネント内で setTimeout、setInterval、requestAnimationFrame を決して使用しないでください — 決定性は useCurrentFrame() からのみ得られます
  • ❌ レンダリング中にデータを決して取得しないでください — 事前に取得し、inputProps 経由で渡してください
  • ❌ 必要以上に多くのフレームを持つコンポーネントを決してレンダリングしないでください — 各フレームはレンダリング時間を消費します
  • ❌ 3 人を超えるチームで商用 Lambda レンダリングをライセンスなしで決して出荷しないでください
  • ❌ Math.random() を直接決して使用しないでください — 出力が決定論的になりません。Remotion の random() をシード付きで使用してください
  • ❌ CSS トランジションでアニメーションを決して行わないでください — Remotion はフレームごとにレンダリングします。CSS トランジションは適用されません。interpolate() + フレームを使用してください

9. 実行前チェックリスト

- [ ] remotion + @remotion/cli がインストールされている
- [ ] src/Root.tsx に動画を定義する <Composition /> がある
- [ ] すべてのアニメーションが useCurrentFrame() によって駆動されている — setTimeout/setInterval がない
- [ ] ランダム値に Remotion の random() がシード付きで使用されている(Math.random ではない)
- [ ] フォントの読み込み: useFont または <link> を <head> で使用
- [ ] オーディオファイルが <Audio> で適切な音量/トリミングで使用されている
- [ ] 本番用: Lambda または remotion render CLI 経由でレンダリング
- [ ] 価格確認済み — チームサイズに適した階層を選択
- [ ] inputProps が各 Composition に対して型付けされている(TypeScript)
- [ ] フルレンダリング前に短いプレビューをテストレンダリングする

10. ダイヤルフィット

動画のデザインに完全に依存します — Remotion はフレームワークであり、ビジュアルライブラリではありません。

11. DesignDNA との統合

Remotion は DesignDNA のブランド DNA と組み合わせるのに最適です: 生成された動画のビジュアル言語として、ブランドの DESIGN.md トークン(色、フォント、スペーシング)を使用します。例:

import { tokens } from '../design-md/stripe/tokens';

<div style={{ color: tokens.colors['stripe-purple'], fontFamily: tokens.typography.families[0] }}>
  Stripe ブランドのイントロ
</div>

こうすることで、あなたの「年間レビュー」動画がブランドのビジュアルアイデンティティに一致します。

12. 代替手段

シナリオ代替手段
従来の非コード動画Adobe After Effects / Premiere
データ可視化動画D3 + 画面収録 または Remotion + D3
アニメーション React コンポーネント(動画全体ではない)Framer Motion · Motion · React Bits(該当スキルを参照)
インタラクティブな Web アニメーションLottie · GSAP

関連スキル