video-tools
Installation
SKILL.md
Video Tools
Overview
Extract frames, create clips, convert formats, and inspect video files using ffmpeg.
Prerequisites
# Install ffmpeg
sudo apt-get install ffmpeg # Ubuntu/Debian
brew install ffmpeg # macOS
Extract Frames
Single frame
# First frame
ffmpeg -i video.mp4 -frames:v 1 /tmp/frame.jpg
# At specific timestamp (10 seconds)
ffmpeg -ss 00:00:10 -i video.mp4 -frames:v 1 /tmp/frame-10s.jpg
# High quality PNG
ffmpeg -ss 00:00:10 -i video.mp4 -frames:v 1 /tmp/frame.png
Multiple frames
# One frame per second
ffmpeg -i video.mp4 -vf fps=1 /tmp/frame-%04d.jpg
# One frame every 10 seconds
ffmpeg -i video.mp4 -vf fps=1/10 /tmp/frame-%04d.jpg
# Specific number of frames (thumbnail grid)
ffmpeg -i video.mp4 -vf "select='not(mod(n,100))',scale=320:-1,tile=3x3" /tmp/grid.jpg
Extract Clips
# Extract 30-second clip starting at 1:00
ffmpeg -ss 00:01:00 -i video.mp4 -t 30 -c copy /tmp/clip.mp4
# Extract with re-encoding (for precise cuts)
ffmpeg -ss 00:01:00 -i video.mp4 -t 30 -c:v libx264 -c:a aac /tmp/clip.mp4
Convert Formats
# MP4 to WebM
ffmpeg -i video.mp4 -c:v libvpx-vp9 -c:a libopus video.webm
# MOV to MP4
ffmpeg -i video.mov -c:v libx264 -c:a aac video.mp4
# Reduce file size
ffmpeg -i video.mp4 -crf 28 -preset fast -c:a copy smaller.mp4
# Extract audio only
ffmpeg -i video.mp4 -vn -c:a libmp3lame audio.mp3
ffmpeg -i video.mp4 -vn -c:a copy audio.aac
Inspect
# Get video info
ffprobe -v quiet -print_format json -show_format -show_streams video.mp4
# Quick summary
ffprobe -v quiet -show_entries format=duration,size,bit_rate -of compact video.mp4
# Get duration
ffprobe -v quiet -show_entries format=duration -of csv=p=0 video.mp4
# Get resolution
ffprobe -v quiet -select_streams v:0 -show_entries stream=width,height -of csv=p=0 video.mp4
GIF Creation
# Video to GIF (with palette for quality)
ffmpeg -i video.mp4 -vf "fps=10,scale=480:-1:flags=lanczos,split[s0][s1];[s0]palettegen[p];[s1][p]paletteuse" output.gif
# Specific section as GIF
ffmpeg -ss 00:00:05 -t 3 -i video.mp4 -vf "fps=15,scale=320:-1" output.gif
Tips
- Use
-c copyfor fast extraction without re-encoding - Use
-crf(18-28) to control quality: lower = better, 23 is default - Use
jpgfor quick previews,pngfor crisp UI frames -preset ultrafastfor speed,-preset slowfor compression- Always use
-ssbefore-ifor fast seeking
Related skills
More from phuetz/code-buddy
ableton-live
Ableton Live music production automation via OSC protocol, MIDI, and Max for Live
3gitlab
GitLab DevOps platform with CI/CD pipelines, API automation, and glab CLI control
3csharp-avalonia
Cross-platform desktop/mobile development with C# and Avalonia UI
3blog-watcher
Monitor blogs, RSS/Atom feeds, and websites for updates
3email-tools
Read and send emails from the terminal using himalaya or curl/SMTP
2project-best-practices
Best practices for initializing and structuring software projects
2