ffmpeg Cheat Sheet

2026-01-29T16:24:54-0500 | 257 words

When I first returned to Tumblr two years ago, I made gifs (well, .webp's) by taking screenshots in VLC while the video played and importing them to GIMP. A waste of time that also led to spotty, irregular frames depending on how my graphics card and memory were. Editing colors in GIMP also would have surely led to repetitive strain injuries since I've yet to find a method or a plugin to apply filters to every layer.

These days, I use mpv to watch video since it pairs nicely with mpd and playerctl, and ffmpeg for editing and extraction. Truly, I can't be bothered to gif anything of significant length anymore, so I tend to cut clips and upload .mp4's instead.

Calling this a "cheat sheet" is generous. I have only two commands to share.

To extract frames for GIFs:

ffmpeg \
    -i input.mkv \
    -ss 00:00:00 -to 00:00:00 \
    -r 12 \
    -q:v 2 \
    frame%03d.jpg

To cut clips:

ffmpeg \
    -i input.mkv \
    -ss 00:00:00 -to 00:00:00 \
    -c copy \ # OR -vf "scale=1280:720" \
    output.mp4