
Ffmpeg
- 5.6k installs
- 1.8k repo stars
- Updated July 6, 2026
- digitalsamba/claude-code-video-toolkit
ffmpeg documents FFmpeg command recipes for converting, resizing, compressing, trimming, and platform-optimizing video and audio for Remotion workflows.
About
The ffmpeg skill in digitalsamba/claude-code-video-toolkit documents FFmpeg commands for video and audio processing in Remotion production pipelines. It covers GIF to MP4 conversion with movflags faststart, yuv420p pixel format, and even-dimension scaling for web players. Resize recipes include letterbox padding, crop-to-fill, and width-based scaling. Compression presets use libx264 CRF values, AAC audio bitrates, and target file size encoding. Audio workflows extract MP3, AAC, or WAV, convert M4A for ElevenLabs samples, and adjust volume filters. Trimming guidance recommends re-encoding over stream copy to avoid keyframe seek issues. Speed change uses filter_complex with setpts and atempo, including chained atempo for extreme rates. Remotion-specific sections compare FFmpeg preprocessing versus playbackRate for constant, extreme, and variable speeds. Platform export recipes optimize masters for YouTube, Twitter, LinkedIn, web embed, and GIF previews with batch export scripts.
- GIF to MP4 and 1080p demo prep recipes with Remotion-ready codecs and fps.
- libx264 CRF compression, audio extraction, trim, concat, and fade filters.
- Speed adjustment with setpts and atempo when playbackRate is insufficient.
- Post-render exports tuned for YouTube, Twitter, LinkedIn, web, and GIF previews.
- Troubleshooting for odd dimensions, browser playback, sync, and oversized files.
Ffmpeg by the numbers
- 5,567 all-time installs (skills.sh)
- +222 installs in the week ending Jul 28, 2026 (Skillselion tracking)
- Ranked #98 of 1,340 Generative Media skills by installs in the Skillselion catalog
- Security screen: MEDIUM risk (skills.sh audit)
- Data as of Jul 28, 2026 (Skillselion catalog sync)
ffmpeg capabilities & compatibility
- Capabilities
- gif to mp4 and remotion ready 1080p normalizatio · resize, compress, trim, concat, and fade command · audio extract and format conversion including el · speed adjustment with setpts and atempo filter_c · platform specific export and batch optimization
- Use cases
- video generation · transcription
- Platforms
- macOS · Linux · Windows
- Runs
- Runs locally
- Pricing
- Free
What ffmpeg says it does
FFmpeg is the essential tool for video/audio processing. This skill covers common operations for Remotion video projects.
Use: `-movflags faststart -pix_fmt yuv420p -c:v libx264`
npx skills add https://github.com/digitalsamba/claude-code-video-toolkit --skill ffmpegAdd your badge
Show developers this skill is listed on Skillselion. Paste this into your README.
| Installs | 5.6k |
|---|---|
| repo stars | ★ 1.8k |
| Security audit | 3 / 3 scanners passed |
| Last updated | July 6, 2026 |
| Repository | digitalsamba/claude-code-video-toolkit ↗ |
How do I preprocess screen recordings, GIFs, and rendered masters into web-safe MP4 assets and social platform exports for Remotion video projects?
Run FFmpeg to convert, resize, compress, trim, speed-adjust, and platform-optimize video and audio assets for Remotion projects.
Who is it for?
Video producers using Remotion who need reliable FFmpeg preprocessing before composition or after render.
Skip if: Skip for in-composition animation logic; use Remotion playbackRate when constant speed inside React is enough.
When should I use this skill?
User asks to convert GIF to MP4, resize or compress video, extract audio, trim clips, change speed, or export for YouTube, Twitter, or web embed.
What you get
Copy-ready FFmpeg commands with correct flags for Remotion assets plus platform-specific MP4, WebM, and GIF outputs.
- FFmpeg CLI commands
- Transcoded or edited media files
By the numbers
- Documents 7 common video filters: scale, crop, fps, pad, fade, setpts, drawtext
Files
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)
ffmpeg -i input.gif -movflags faststart -pix_fmt yuv420p \
-vf "scale=trunc(iw/2)*2:trunc(ih/2)*2" output.mp4Why 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
# To 1920x1080 (maintain aspect ratio, add black bars)
ffmpeg -i input.mp4 -vf "scale=1920:1080:force_original_aspect_ratio=decrease,pad=1920:1080:(ow-iw)/2:(oh-ih)/2" output.mp4
# To 1920x1080 (crop to fill)
ffmpeg -i input.mp4 -vf "scale=1920:1080:force_original_aspect_ratio=increase,crop=1920:1080" output.mp4
# Scale to width, auto height
ffmpeg -i input.mp4 -vf "scale=1280:-2" output.mp4Compress Video
# Good quality, smaller file (CRF 23 is default, lower = better quality)
ffmpeg -i input.mp4 -c:v libx264 -crf 23 -preset medium -c:a aac -b:a 128k output.mp4
# Aggressive compression for web preview
ffmpeg -i input.mp4 -c:v libx264 -crf 28 -preset fast -c:a aac -b:a 96k output.mp4
# Target file size (e.g., ~10MB for 60s video = ~1.3Mbps)
ffmpeg -i input.mp4 -c:v libx264 -b:v 1300k -c:a aac -b:a 128k output.mp4Extract Audio
# Extract to MP3
ffmpeg -i input.mp4 -vn -acodec libmp3lame -q:a 2 output.mp3
# Extract to AAC
ffmpeg -i input.mp4 -vn -acodec aac -b:a 192k output.m4a
# Extract to WAV (uncompressed)
ffmpeg -i input.mp4 -vn output.wavConvert Audio Formats
# M4A to MP3 (for ElevenLabs voice samples)
ffmpeg -i input.m4a -codec:a libmp3lame -qscale:a 2 output.mp3
# WAV to MP3
ffmpeg -i input.wav -codec:a libmp3lame -b:a 192k output.mp3
# Adjust volume
ffmpeg -i input.mp3 -filter:a "volume=1.5" output.mp3Trim/Cut Video
# Cut from timestamp to duration (recommended - reliable)
ffmpeg -i input.mp4 -ss 00:00:30 -t 00:00:15 -c:v libx264 -c:a aac output.mp4
# Cut from timestamp to timestamp
ffmpeg -i input.mp4 -ss 00:00:30 -to 00:00:45 -c:v libx264 -c:a aac output.mp4
# Stream copy (faster but may lose frames at cut points)
# Only use when source has frequent keyframes
ffmpeg -i input.mp4 -ss 00:00:30 -t 00:00:15 -c copy output.mp4Note: 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
# 2x speed (video and audio)
ffmpeg -i input.mp4 -filter_complex "[0:v]setpts=0.5*PTS[v];[0:a]atempo=2.0[a]" -map "[v]" -map "[a]" output.mp4
# 0.5x speed (slow motion)
ffmpeg -i input.mp4 -filter_complex "[0:v]setpts=2.0*PTS[v];[0:a]atempo=0.5[a]" -map "[v]" -map "[a]" output.mp4
# Video only (no audio)
ffmpeg -i input.mp4 -filter:v "setpts=0.5*PTS" -an output.mp4Concatenate Videos
# Create file list
echo "file 'clip1.mp4'" > list.txt
echo "file 'clip2.mp4'" >> list.txt
echo "file 'clip3.mp4'" >> list.txt
# Concatenate (same codec/resolution)
ffmpeg -f concat -safe 0 -i list.txt -c copy output.mp4
# Concatenate with re-encoding (different sources)
ffmpeg -f concat -safe 0 -i list.txt -c:v libx264 -c:a aac output.mp4Add Fade In/Out
# Fade in first 1 second, fade out last 1 second (30fps video)
ffmpeg -i input.mp4 -vf "fade=t=in:st=0:d=1,fade=t=out:st=9:d=1" -c:a copy output.mp4
# Audio fade
ffmpeg -i input.mp4 -af "afade=t=in:st=0:d=1,afade=t=out:st=9:d=1" -c:v copy output.mp4Get Video Info
# Duration, resolution, codec info
ffprobe -v error -show_entries format=duration -of default=noprint_wrappers=1:nokey=1 input.mp4
# Full info
ffprobe -v quiet -print_format json -show_format -show_streams input.mp4Remotion-Specific Patterns
Video Speed Adjustment for Remotion
When to use FFmpeg vs Remotion `playbackRate`:
| Scenario | Use FFmpeg | Use Remotion |
|---|---|---|
| Constant speed (1.5x, 2x) | Either works | ✅ Simpler |
| Extreme speeds (>4x or <0.25x) | ✅ More reliable | May have issues |
| Variable speed (accelerate over time) | ✅ Pre-process | Complex workaround needed |
| Need perfect audio sync | ✅ Guaranteed | Usually fine |
| Demo needs to fit voiceover timing | ✅ Pre-calculate | Runtime adjustment |
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.
# Speed up demo to fit a scene (e.g., 60s demo into 20s = 3x speed)
ffmpeg -i demo-raw.mp4 \
-filter_complex "[0:v]setpts=0.333*PTS[v];[0:a]atempo=3.0[a]" \
-map "[v]" -map "[a]" \
public/demos/demo-fast.mp4
# Slow motion for emphasis (0.5x speed)
ffmpeg -i action.mp4 \
-filter_complex "[0:v]setpts=2.0*PTS[v];[0:a]atempo=0.5[a]" \
-map "[v]" -map "[a]" \
public/demos/action-slow.mp4
# Speed up without audio (common for screen recordings)
ffmpeg -i demo.mp4 -filter:v "setpts=0.5*PTS" -an public/demos/demo-2x.mp4
# Timelapse effect (10x speed, drop audio)
ffmpeg -i long-demo.mp4 -filter:v "setpts=0.1*PTS" -an public/demos/timelapse.mp4Calculate 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):
# 4x speed audio
-filter_complex "[0:a]atempo=2.0,atempo=2.0[a]"
# 8x speed audio
-filter_complex "[0:a]atempo=2.0,atempo=2.0,atempo=2.0[a]"Prepare Demo Recording for Remotion
# Standard 1080p, 30fps, Remotion-ready
ffmpeg -i raw-recording.mp4 \
-vf "scale=1920:1080:force_original_aspect_ratio=decrease,pad=1920:1080:(ow-iw)/2:(oh-ih)/2,fps=30" \
-c:v libx264 -crf 18 -preset slow \
-c:a aac -b:a 192k \
-movflags faststart \
public/demos/demo.mp4Screen Recording to Remotion Asset
# From iPhone/iPad recording (usually 60fps, variable resolution)
ffmpeg -i iphone-recording.mov \
-vf "scale=1920:-2,fps=30" \
-c:v libx264 -crf 20 \
-an \
public/demos/mobile-demo.mp4Batch Convert GIFs
for f in assets/*.gif; do
ffmpeg -i "$f" -movflags faststart -pix_fmt yuv420p \
-vf "scale=trunc(iw/2)*2:trunc(ih/2)*2" \
"public/demos/$(basename "$f" .gif).mp4"
doneCommon 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
| Use Case | CRF | Preset | Notes |
|---|---|---|---|
| Archive/Master | 18 | slow | Best quality, large files |
| Production | 20-22 | medium | Good balance |
| Web/Preview | 23-25 | fast | Smaller files |
| Draft/Quick | 28+ | veryfast | Fast encoding |
Platform-Specific Output Optimization
After Remotion renders your video (typically to out/video.mp4), use FFmpeg to optimize for each distribution platform.
Workflow Integration
Remotion render (master) FFmpeg optimization Platform upload
↓ ↓ ↓
out/video.mp4 ────────→ out/video-youtube.mp4 ───→ YouTube
────────→ out/video-twitter.mp4 ───→ Twitter/X
────────→ out/video-linkedin.mp4 ───→ LinkedIn
────────→ out/video-web.mp4 ───→ Website embedYouTube (Recommended Settings)
YouTube re-encodes everything, so upload high quality:
# YouTube optimized (1080p)
ffmpeg -i out/video.mp4 \
-c:v libx264 -preset slow -crf 18 \
-profile:v high -level 4.0 \
-bf 2 -g 30 \
-c:a aac -b:a 192k -ar 48000 \
-movflags +faststart \
out/video-youtube.mp4
# YouTube Shorts (vertical 1080x1920)
ffmpeg -i out/video.mp4 \
-vf "scale=1080:1920:force_original_aspect_ratio=decrease,pad=1080:1920:(ow-iw)/2:(oh-ih)/2" \
-c:v libx264 -crf 18 -c:a aac -b:a 192k \
out/video-shorts.mp4Twitter/X
Twitter has strict limits: max 140s, 512MB, 1920x1200:
# Twitter optimized (under 15MB target for fast upload)
ffmpeg -i out/video.mp4 \
-c:v libx264 -preset medium -crf 24 \
-profile:v main -level 3.1 \
-vf "scale='min(1280,iw)':'min(720,ih)':force_original_aspect_ratio=decrease" \
-c:a aac -b:a 128k -ar 44100 \
-movflags +faststart \
-fs 15M \
out/video-twitter.mp4
# Check file size and duration
ffprobe -v error -show_entries format=duration,size -of csv=p=0 out/video-twitter.mp4LinkedIn prefers MP4 with AAC audio, max 10 minutes:
# LinkedIn optimized
ffmpeg -i out/video.mp4 \
-c:v libx264 -preset medium -crf 22 \
-profile:v main \
-vf "scale='min(1920,iw)':'min(1080,ih)':force_original_aspect_ratio=decrease" \
-c:a aac -b:a 192k -ar 48000 \
-movflags +faststart \
out/video-linkedin.mp4Website/Embed (Optimized for Fast Loading)
# Web-optimized MP4 (small file, progressive loading)
ffmpeg -i out/video.mp4 \
-c:v libx264 -preset medium -crf 26 \
-profile:v baseline -level 3.0 \
-vf "scale=1280:720" \
-c:a aac -b:a 128k \
-movflags +faststart \
out/video-web.mp4
# WebM alternative (better compression, wider browser support)
ffmpeg -i out/video.mp4 \
-c:v libvpx-vp9 -crf 30 -b:v 0 \
-vf "scale=1280:720" \
-c:a libopus -b:a 128k \
-deadline good \
out/video-web.webmGIF (for Previews/Thumbnails)
# High-quality GIF (first 5 seconds)
ffmpeg -i out/video.mp4 -t 5 \
-vf "fps=15,scale=480:-1:flags=lanczos,split[s0][s1];[s0]palettegen[p];[s1][p]paletteuse" \
out/preview.gif
# Smaller file GIF
ffmpeg -i out/video.mp4 -t 3 \
-vf "fps=10,scale=320:-1:flags=lanczos,split[s0][s1];[s0]palettegen[p];[s1][p]paletteuse" \
out/preview-small.gifPlatform Requirements Quick Reference
| Platform | Max Resolution | Max Size | Max Duration | Audio |
|---|---|---|---|---|
| YouTube | 8K | 256GB | 12 hours | AAC 48kHz |
| Twitter/X | 1920x1200 | 512MB | 140s | AAC 44.1kHz |
| 4096x2304 | 5GB | 10 min | AAC 48kHz | |
| Instagram Feed | 1080x1350 | 4GB | 60s | AAC 48kHz |
| Instagram Reels | 1080x1920 | 4GB | 90s | AAC 48kHz |
| TikTok | 1080x1920 | 287MB | 10 min | AAC |
Batch Export for All Platforms
#!/bin/bash
# save as: export-all-platforms.sh
INPUT="out/video.mp4"
# YouTube (high quality)
ffmpeg -i "$INPUT" -c:v libx264 -preset slow -crf 18 \
-c:a aac -b:a 192k -movflags +faststart \
out/video-youtube.mp4
# Twitter (compressed)
ffmpeg -i "$INPUT" -c:v libx264 -crf 24 \
-vf "scale='min(1280,iw)':'-2'" \
-c:a aac -b:a 128k -movflags +faststart \
out/video-twitter.mp4
# LinkedIn
ffmpeg -i "$INPUT" -c:v libx264 -crf 22 \
-c:a aac -b:a 192k -movflags +faststart \
out/video-linkedin.mp4
# Web embed (small)
ffmpeg -i "$INPUT" -c:v libx264 -crf 26 \
-vf "scale=1280:720" \
-c:a aac -b:a 128k -movflags +faststart \
out/video-web.mp4
echo "Exported:"
ls -lh out/video-*.mp4Error Handling
Common errors and fixes when processing video:
# Check if FFmpeg succeeded
ffmpeg -i input.mp4 -c:v libx264 output.mp4 && echo "Success" || echo "Failed: check input file"
# Validate output file is playable
ffprobe -v error -select_streams v:0 -show_entries stream=codec_name -of csv=p=0 output.mp4
# Get detailed error info
ffmpeg -v error -i input.mp4 -f null - 2>&1 | head -20Handling Common Failures
| Error | Cause | Fix |
|---|---|---|
| "No such file" | Input path wrong | Check path, use quotes for spaces |
| "Invalid data" | Corrupted input | Re-download or re-record source |
| "height not divisible by 2" | Odd dimensions | Add scale filter with trunc |
| "encoder not found" | Missing codec | Install FFmpeg with full codecs |
| Output 0 bytes | Silent failure | Check full ffmpeg output for errors |
---
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:
1. Update this skill with improvements 2. 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.
FFmpeg Reference
Filter Syntax
Video Filters (-vf)
# Chain filters with comma
-vf "scale=1920:1080,fps=30,crop=1280:720"
# Complex filters with labels
-filter_complex "[0:v]scale=1920:1080[scaled];[scaled]fps=30[out]" -map "[out]"Common Video Filters
| Filter | Syntax | Example |
|---|---|---|
| scale | scale=w:h | scale=1920:1080 or scale=1280:-1 (auto height) |
| crop | crop=w:h:x:y | crop=1280:720:320:180 |
| fps | fps=N | fps=30 |
| pad | pad=w:h:x:y:color | pad=1920:1080:(ow-iw)/2:(oh-ih)/2:black |
| fade | fade=t=in/out:st=N:d=N | fade=t=in:st=0:d=1 |
| setpts | setpts=N*PTS | setpts=0.5*PTS (2x speed) |
| drawtext | drawtext=text='Hi':fontsize=24 | Add text overlay |
| overlay | overlay=x:y | Combine videos |
Common Audio Filters (-af)
| Filter | Syntax | Example |
|---|---|---|
| volume | volume=N | volume=1.5 or volume=0.5 |
| afade | afade=t=in/out:st=N:d=N | afade=t=in:st=0:d=1 |
| atempo | atempo=N | atempo=2.0 (2x speed, range 0.5-2.0) |
| loudnorm | loudnorm | Normalize audio levels |
Codec Options
Video Codecs (-c:v)
| Codec | Use Case | Notes |
|---|---|---|
| libx264 | Universal H.264 | Best compatibility |
| libx265 | H.265/HEVC | Better compression, less compatible |
| libvpx-vp9 | WebM | Good for web |
| prores | ProRes | Professional editing |
| copy | Stream copy | No re-encoding, fastest |
Audio Codecs (-c:a)
| Codec | Use Case | Notes |
|---|---|---|
| aac | MP4 container | Most compatible |
| libmp3lame | MP3 | Universal |
| libvorbis | WebM/OGG | Open source |
| pcm_s16le | WAV | Uncompressed |
| copy | Stream copy | No re-encoding |
Quality Settings
CRF (Constant Rate Factor) for x264/x265
| CRF | Quality | Use Case |
|---|---|---|
| 0 | Lossless | Archive |
| 17-18 | Visually lossless | Master |
| 19-22 | High quality | Production |
| 23 | Default | General use |
| 24-27 | Medium | Web delivery |
| 28+ | Low | Preview/draft |
Presets (-preset)
Faster presets = larger files, quicker encoding
ultrafast → superfast → veryfast → faster → fast → medium → slow → slower → veryslow
Container Formats
| Format | Extension | Best For |
|---|---|---|
| MP4 | .mp4 | Universal, web, mobile |
| MOV | .mov | Apple ecosystem, ProRes |
| WebM | .webm | Web (VP9) |
| MKV | .mkv | Archive, multiple streams |
| GIF | .gif | Short animations (no audio) |
Input/Output Options
Input Options (before -i)
| Option | Purpose | Example |
|---|---|---|
| -ss | Seek to time | -ss 00:01:30 |
| -t | Duration limit | -t 00:00:30 |
| -r | Input framerate | -r 30 |
| -f | Force format | -f gif |
Output Options (after -i)
| Option | Purpose | Example |
|---|---|---|
| -y | Overwrite output | -y |
| -n | Never overwrite | -n |
| -movflags faststart | Web streaming | -movflags faststart |
| -pix_fmt | Pixel format | -pix_fmt yuv420p |
| -an | No audio | -an |
| -vn | No video | -vn |
Useful Patterns
Get Duration in Seconds
ffprobe -v error -show_entries format=duration -of csv=p=0 input.mp4Get Resolution
ffprobe -v error -select_streams v:0 -show_entries stream=width,height -of csv=p=0 input.mp4Get Frame Count
ffprobe -v error -select_streams v:0 -count_frames -show_entries stream=nb_read_frames -of csv=p=0 input.mp4Create Thumbnail
# At specific time
ffmpeg -i input.mp4 -ss 00:00:05 -vframes 1 thumbnail.jpg
# Best quality
ffmpeg -i input.mp4 -ss 00:00:05 -vframes 1 -q:v 2 thumbnail.jpgCreate GIF from Video
# Simple (large file)
ffmpeg -i input.mp4 -vf "fps=10,scale=480:-1" output.gif
# With palette (better quality, smaller)
ffmpeg -i input.mp4 -vf "fps=10,scale=480:-1,split[s0][s1];[s0]palettegen[p];[s1][p]paletteuse" output.gifPicture-in-Picture
# Overlay small video in corner
ffmpeg -i main.mp4 -i overlay.mp4 \
-filter_complex "[1:v]scale=320:-1[pip];[0:v][pip]overlay=W-w-20:H-h-20" \
-c:a copy output.mp4Side-by-Side Videos
ffmpeg -i left.mp4 -i right.mp4 \
-filter_complex "[0:v][1:v]hstack=inputs=2[v]" \
-map "[v]" -c:v libx264 output.mp4Remotion Integration Notes
- Remotion uses
<OffthreadVideo>which handles most formats - Prefer H.264 (libx264) in MP4 container
- Always use
-movflags faststartfor web playback - Match fps to composition (usually 30fps)
- Resolution should match composition (1920x1080 typical)
Related skills
Forks & variants (1)
Ffmpeg has 1 known copy in the catalog totaling 377 installs. They canonicalize to this original listing.
- calesthio - 377 installs
FAQ
What does ffmpeg do?
ffmpeg documents FFmpeg command recipes for converting, resizing, compressing, trimming, and platform-optimizing video and audio for Remotion workflows.
When should I use ffmpeg?
User asks to convert GIF to MP4, resize or compress video, extract audio, trim clips, change speed, or export for YouTube, Twitter, or web embed.
Is this skill safe to install?
Review the Security Audits panel on this page before installing in production.