Remotion 動画生成スキル は何をしますか?
App Factory には、ビルドされたアプリケーションのデモ動画を生成するための Remotion 動画パイプラインが統合されています。
このスキルが適用される場合
demo-video/ディレクトリ内のファイルを操作する/factory videoコマンドを実行する- Remotion コンポジションを作成または修正する
- 動画レンダリングの問題をデバッグする
- フレームベースのアニメーションを理解する
プロジェクト構造
demo-video/
├── src/
│ ├── index.ts # Remotion エントリポイント
│ ├── Root.tsx # コンポジション登録
│ ├── compositions/
│ │ └── AppFactoryDemo.tsx # メインデモ動画(10秒、1920x1080)
│ └── components/
│ ├── Title.tsx # アニメーションタイトル
│ ├── BulletPoints.tsx # 段階表示のハイライト
│ ├── VerificationBadge.tsx # PASS バッジ
│ └── Footer.tsx # UTC タイムスタンプ
├── remotion.config.ts # Remotion 設定
└── package.json # 依存関係(Remotion v4.x)
重要なルール(必ず従うこと)
1. フレームベースのアニメーションのみ
// 正しい: すべてのアニメーションに useCurrentFrame() を使用する
const frame = useCurrentFrame();
const opacity = interpolate(frame, [0, 30], [0, 1], {
extrapolateRight: 'clamp',
});
// 禁止: CSS アニメーション/トランジション
// 以下は絶対に使用しない: animation:, transition:, @keyframes
2. 補間時にクランプする
// 常に補間のクランプを使用する
const value = interpolate(frame, [0, 60], [0, 100], {
extrapolateLeft: 'clamp',
extrapolateRight: 'clamp',
});
3. スプリングアニメーション
// 物理ベースのアニメーションには spring() を使用する
const springValue = spring({
fps,
frame,
config: { damping: 200, stiffness: 100 },
durationInFrames: 40,
});
4. 決定論に関する要件
- タイムスタンプは入力 props として渡すこと。
new Date()は使用しない - 日付のフォーマットには
timeZone: 'UTC'を使用する Math.random()や非決定論的な値は使用しない- 同じ props からは同じ動画出力を生成する必要がある
5. コンポーネント構造
// すべてのコンポジションはこのパターンに従う必要があります
export const MyComposition: React.FC<Props> = (props) => {
const frame = useCurrentFrame();
const { fps, width, height, durationInFrames } = useVideoConfig();
return (
<AbsoluteFill style={{ backgroundColor: '#000' }}>
{/* シーケンス化されたコンテンツ */}
<Sequence from={0} durationInFrames={60}>
<Scene1 />
</Sequence>
<Sequence from={60} durationInFrames={60}>
<Scene2 />
</Sequence>
</AbsoluteFill>
);
};
パイプライン統合
自動生成フロー
- ローカル実行証明の検証が実行される
RUN_CERTIFICATE.jsonがstatus: "PASS"で作成される- フックが
post-run-certificate-video.mjsをトリガーする - デモ動画が
demo/out/<slug>.mp4にレンダリングされる
手動レンダリング
# 基本的な使い方
node scripts/render-demo-video.mjs --cwd ./my-app --slug my-app
# カスタムハイライト付き
node scripts/render-demo-video.mjs \
--cwd ./my-app \
--slug my-app \
--title "My Amazing App" \
--highlights '["Feature 1", "Feature 2", "Feature 3"]'
Props スキーマ
interface AppFactoryDemoProps {
title: string; // アプリ名
slug: string; // URL セーフな識別子
verifiedUrl: string; // ヘルスチェックに合格した Localhost URL
timestamp: string; // ISO 8601 タイムスタンプ(UTC)
highlights: string[]; // 4~6 個の箇条書き
certificateHash: string; // RUN_CERTIFICATE.json の SHA256
}
デバッグ
# Remotion Studio でプレビュー
cd demo-video && npm run studio
# 特定のコンポジションをレンダリング
npx remotion render src/index.ts AppFactoryDemo output.mp4
# TypeScript エラーを確認
npx tsc --noEmit
よくあるパターン
フェードイン/アウト
const fadeIn = interpolate(frame, [0, 30], [0, 1], {
extrapolateRight: 'clamp',
});
const fadeOut = interpolate(frame, [duration - 30, duration], [1, 0], {
extrapolateLeft: 'clamp',
extrapolateRight: 'clamp',
});
const opacity = fadeIn * fadeOut;
段階表示アニメーション
items.map((item, index) => {
const delay = index * 10; // 各アイテム間のフレーム数
const itemOpacity = interpolate(
frame,
[delay, delay + 20],
[0, 1],
{ extrapolateLeft: 'clamp', extrapolateRight: 'clamp' }
);
return <Item key={index} style={{ opacity: itemOpacity }} />;
});
スプリングによるスケール
const scaleSpring = spring({
fps,
frame: frame - startFrame,
config: { damping: 80, stiffness: 200 },
});
const scale = interpolate(scaleSpring, [0, 1], [0.8, 1]);
エラーコード
| コード | 意味 | 解決方法 |
|---|---|---|
| FAC-006 | 動画レンダリング失敗 | Remotion のログを確認し、ffmpeg のインストールを確認する |
| FAC-007 | 証明書が見つからない | 最初にローカル実行証明を実行する |
| FAC-008 | Props 検証に失敗した | プロパティの型がスキーマと一致するか確認する |