Extract evenly-spaced still frames from a video file or YouTube URL.
brew install wimdetroyer/toolz/video-framesDependencies (ffmpeg, yt-dlp) are installed automatically.
git clone https://github.com/wimdetroyer/video-frames.git
cp video-frames/bin/video-frames /usr/local/bin/Or install the script directly:
curl -fsSL https://raw.githubusercontent.com/wimdetroyer/video-frames/main/bin/video-frames \
-o /usr/local/bin/video-frames && chmod +x /usr/local/bin/video-framesvideo-frames [options] <video-file-or-youtube-url>
| Flag | Description | Default |
|---|---|---|
-n N |
Number of frames to extract | 6 |
-o DIR |
Output directory | /tmp/frames-XXXXXXXX/ |
-w WIDTH |
Max width in px (preserves aspect ratio) | 1080 |
-f FORMAT |
Output format: png or jpg |
jpg |
# Extract 6 frames from a local video
video-frames video.mp4
# Extract 12 frames from a YouTube video
video-frames -n 12 https://www.youtube.com/watch?v=dQw4w9WgXcQ
# Save as PNG to a specific directory
video-frames -f png -o ./my-frames video.movOutput is one absolute frame path per line on stdout. Progress/info goes to stderr.
- ffmpeg (required) - install via your package manager
- yt-dlp (optional) - only needed for YouTube URL support
MIT