FFmpeg for Video Production
FFmpeg is the essential tool for video/audio processing. This skill covers common operations for Remotion video projects.
Quick Reference
GIF to MP4 (Remotion-compatible)
Why these flags:
-movflags faststart- Moves metadata to start for web streaming-pix_fmt yuv420p- Ensures compatibility with most playersscale=trunc(...)- Forces even dimensions (required by most codecs)
Resize Video
Compress Video
Extract Audio
Convert Audio Formats
Trim/Cut Video
Note: Re-encoding is recommended for trimming. Stream copy (-c copy) can silently drop video if the seek point doesn't align with a keyframe.
Speed Up / Slow Down
Concatenate Videos
Add Fade In/Out
Get Video Info
Remotion-Specific Patterns
Video Speed Adjustment for Remotion
When to use FFmpeg vs Remotion playbackRate:
Remotion limitation: playbackRate must be constant. Dynamic interpolation like playbackRate={interpolate(frame, [0, 100], [1, 5])} won't work correctly because Remotion evaluates frames independently.
Calculate speed factor:
- To fit X seconds of video into Y seconds of scene:
speed = X / Y - setpts multiplier =
1 / speed(e.g., 3x speed = setpts=0.333*PTS) - atempo value =
speed(e.g., 3x speed = atempo=3.0)
Extreme speed (>2x audio): Chain atempo filters (each limited to 0.5-2.0 range):
Prepare Demo Recording for Remotion
Screen Recording to Remotion Asset
Batch Convert GIFs
Common Issues
"Height not divisible by 2"
Add scale filter: -vf "scale=trunc(iw/2)*2:trunc(ih/2)*2"
Video won't play in browser
Use: -movflags faststart -pix_fmt yuv420p -c:v libx264
Audio out of sync after speed change
Use filter_complex with atempo: -filter_complex "[0:v]setpts=0.5*PTS[v];[0:a]atempo=2.0[a]"
File too large
Increase CRF (23→28) or reduce resolution
Quality Guidelines
Platform-Specific Output Optimization
After Remotion renders your video (typically to out/video.mp4), use FFmpeg to optimize for each distribution platform.
Workflow Integration
YouTube (Recommended Settings)
YouTube re-encodes everything, so upload high quality:
Twitter/X
Twitter has strict limits: max 140s, 512MB, 1920x1200:
LinkedIn prefers MP4 with AAC audio, max 10 minutes:
Website/Embed (Optimized for Fast Loading)
GIF (for Previews/Thumbnails)
Platform Requirements Quick Reference
Batch Export for All Platforms
Error Handling
Common errors and fixes when processing video:
Handling Common Failures
Feedback & Contributions
If this skill is missing information or could be improved:
- Missing a command? Describe what you needed
- Found an error? Let me know what's wrong
- Want to contribute? I can help you:
- Update this skill with improvements
- Create a PR to github.com/digitalsamba/claude-code-video-toolkit
Just say "improve this skill" and I'll guide you through updating .claude/skills/ffmpeg/SKILL.md.

