🎬 Remotion Video Generation Skill
This skill provides the capabilities to generate videos programmatically using Remotion (React-based video framework). It bridges the gap between Python agents and the Node.js/React rendering engine.
📦 Dependencies & Setup
System Requirements:
- •Node.js (v16+) and npm/yarn/pnpm
- •FFmpeg (usually handled by Remotion, but good to have)
- •Python 3.8+ (for the wrapper script)
Python Packages:
run uv add remotion-lambda python-dotenv
Remotion Project Setup: If no project exists, initialize one:
bash
npx create-remotion@latest ./remotion_projects/my-video --template=helloworld
🏗️ Workflows
1. Scouting Composition Schemas
Before rendering, you must understand what data the video needs.
- •Locate
src/Root.tsxorsrc/compositions/. - •Look for
z.objectschemas used in<Composition schema={...} />. - •Crucial: These schemas define the structure of the JSON props you must generate.
2. Rendering Videos (The Hybrid Approach)
Use the provided helper script: .claude/skills/video-remotion/scripts/remotion_wrapper.py.
Option A: Local Rendering (Development/Preview)
Best for quick checks, debugging, or when offline.
- •Generate Props: Create a JSON file (e.g.,
props.json) matching the composition's schema. - •Run Wrapper:
bash
python .claude/skills/video-remotion/scripts/remotion_wrapper.py \ --mode local \ --project-dir /path/to/remotion-project \ --composition MyCompId \ --props props.json \ --output out/video.mp4
Option B: Lambda Rendering (Production)
Best for long videos, final outputs, and speed. Requires AWS Setup.
- •Ensure Policies: User needs
remotion-lambda-userandremotion-lambda-role. - •Deploy (Once):
Capture the Serve URL and Function Name.bash
npx remotion lambda sites create src/index.ts npx remotion lambda functions deploy
- •Run Wrapper:
bash
# Ensure env vars are set: REMOTION_APP_REGION, REMOTION_APP_SERVE_URL, REMOTION_APP_FUNCTION_NAME python .claude/skills/video-remotion/scripts/remotion_wrapper.py \ --mode lambda \ --project-dir /path/to/remotion-project \ --composition MyCompId \ --props props.json
3. Creating New Templates
To create a NEW type of video:
- •Create a React component file in
src/compositions/. - •Define a Zod schema for its props.
- •Register it in
src/Root.tsx. - •Pattern: Use
AbsoluteFillfor layout,Sequencefor timing, andspring/interpolatefor motion.
🧠 Best Practices
- •Props as Files: Always write props to a temporary JSON file and pass the path. Passing complex JSON strings in CLI arguments is fragile.
- •Assets:
- •Local: Use
staticFile('image.png')(put files inpublic/). - •Lambda: Use public HTTP URLs (e.g., S3 buckets, Unsplash) or ensuring
public/folder is correctly deployed with the site.
- •Local: Use
- •Duration: If the video length depends on the text/content, use
calculateMetadatain the composition to dynamically setdurationInFrames.
🐛 Troubleshooting
- •"Command not found: remotion": Ensure you run commands inside the project directory where
node_modulesare installed, or usenpx remotion. - •Lambda Permissions: 90% of Lambda failures are AWS IAM issues. Run
npx remotion lambda policies userto fix. - •Timeout: If Local render hangs, try reducing
--concurrency.