Skip to commands
VideoStabilizer
A growing command notebook

FFmpeg Corner

A little space for the command-line magic behind digital video.

FFmpeg is one of the reasons this project exists. I love how one open-source multimedia toolkit can inspect, convert, trim, filter and encode video and audio. This page starts small: short commands worth keeping and understanding, beginning with the stabilization filter behind our tool.

Terminal / video-notes
$ ffmpeg -version
▶ Filters   ▶ Codecs   ▶ Ideas

Start here

Get FFmpeg from its official download page. Open a terminal and verify the installation with ffmpeg -version. For the examples below, put a video called input.mp4 in the current directory, or replace the filename with a full path. Each command produces a separate output file.

Different builds include different encoders and filters. Check whether your installation includes deshake by running ffmpeg -filters.

01

Stabilize handheld footage

FFmpeg’s deshake filter attempts to correct small horizontal and vertical shifts. rx/ry define the search range; mirror fills gaps at frame edges. It does not repair motion blur.

COPY & RUN IN YOUR TERMINAL
FFmpeg command · stabilization
ffmpeg -i input.mp4 -vf "deshake=rx=32:ry=32:edge=mirror" -c:v libx264 -crf 20 -preset medium -c:a copy stabilized.mp4
02

Trim a ten-second clip

Start five seconds into a video and keep the next ten seconds. Re-encoding allows accurate cuts and takes more time than stream copying.

COPY & RUN IN YOUR TERMINAL
FFmpeg command · editing
ffmpeg -ss 00:00:05 -i input.mp4 -t 00:00:10 -c:v libx264 -crf 22 -preset medium -c:a aac -b:a 128k clip.mp4
03

Resize video to 720p

The -2 width value preserves aspect ratio while keeping the calculated width divisible by two. Resizing discards detail; it does not always guarantee a smaller file.

COPY & RUN IN YOUR TERMINAL
FFmpeg command · formatting
ffmpeg -i input.mp4 -vf "scale=-2:720" -c:v libx264 -crf 23 -preset medium -c:a aac -b:a 128k resized-720p.mp4
04

Extract a single video frame

Save a JPEG around three seconds into the footage. Make sure the recording is long enough; this extracts a picture, not a stabilized video.

COPY & RUN IN YOUR TERMINAL
FFmpeg command · frames
ffmpeg -ss 00:00:03 -i input.mp4 -frames:v 1 thumbnail.jpg

More experiments to come

I will keep expanding this one page with useful tips and individual commands. Upcoming ideas: removing audio, checking codecs with ffprobe, extracting an audio track, and creating side-by-side videos. They're ideas for future entries, not published commands yet.

Prefer a click instead of a terminal? Stabilize a video online. Curious how it works? Read our browser-processing explanation.

This independent learning notebook is not affiliated with or endorsed by the FFmpeg project. For authoritative syntax and licensing information, consult the official FFmpeg documentation. Commands were tested with FFmpeg 7.1.5; results depend on your video and FFmpeg build.