← Dashboard

cheat sheets / media

FFmpeg & ImageMagick Cheat Sheets — Media From the Command Line

Two tools handle almost all audio, video, and image processing, and both have syntax nobody remembers. Here are the references worth keeping, the mental model that makes them readable, and the mistakes that cost people their originals.

updated aug 2026·2 references·a 7-minute read·free

FFmpeg and ImageMagick sit underneath an enormous amount of software you already use. Video sites, chat apps, content management systems, and most "convert this file" web tools are running one of them somewhere in the stack. Both can do nearly anything to a media file, and both are notorious for command syntax that is impossible to recall between uses. That combination is exactly what cheat sheets exist for. This page points at the two references worth bookmarking and, more usefully, explains the logic behind the syntax so the sheets stop looking like noise.

01 · THE MENTAL MODEL

Why the syntax feels impossible

The usual complaint about FFmpeg is that commands look like line noise. The reason is that argument order carries meaning, which is unusual for command-line tools. An FFmpeg command is read as a sequence of stages: options that apply to the input, then the input file, then options that apply to the output, then the output file. An option placed before -i configures how the file is read; the same option after it configures how the file is written. Once you know that, the wall of flags resolves into a shape you can scan.

ImageMagick works on a similar principle. Its commands read left to right as a pipeline: start with an image, apply operations in sequence, write the result. Operators are applied in the order you write them, so resizing then cropping produces a different result from cropping then resizing. This trips people up constantly, and it is the single most useful thing to understand before opening a reference.

Neither tool is trying to be difficult. Both are old, extremely capable, and shaped by decades of accumulated options. The cheat sheets below are valuable precisely because they surface the ten percent that covers almost all real work.

02 · THE REFERENCES

FFmpeg & ImageMagick quick references

Both of these are Devhints pages: single-screen, no prose, organized by task rather than alphabetically. That task-first ordering is what makes them fast — you arrive knowing what you want to do, not which flag does it.

For anything the sheets don't cover, both projects publish thorough official documentation. It is dense, but it is complete and accurate, which matters more than readability once you are past the common cases.

03 · FFMPEG

The handful of FFmpeg ideas worth knowing

Stream copy is the fast path

Re-encoding video is slow and loses quality every time. When you only need to change the container, trim on a rough boundary, or strip a track, copying the streams instead of decoding and re-encoding does the job in seconds rather than minutes and loses nothing. This is the difference between a command that finishes instantly and one that pins your CPU for ten minutes, and beginners re-encode constantly without realizing there was a choice.

Quality is a number, not a guess

When you do need to re-encode, quality is usually controlled by a constant-rate-factor value rather than a bitrate. Lower numbers mean higher quality and larger files. Around 18 is generally considered visually indistinguishable from the source, the common default sits near 23, and the difference between them is often a large reduction in file size for very little visible loss. Reaching for a specific bitrate is rarely the right instinct unless you have a hard size target.

Seeking has a trade-off

Where you place the seek option changes its behavior. Placed before the input, FFmpeg jumps to the nearest keyframe, which is very fast but may land slightly off your intended timestamp. Placed after the input, it decodes up to the exact frame, which is accurate but slower. Knowing that one detail explains most "why is my clip starting in the wrong place?" confusion.

TIPScaling to an odd number of pixels will fail. Most common video codecs require dimensions divisible by two, so a height that works out odd produces an error rather than a video. The standard fix is to fix one dimension and let FFmpeg compute the other to preserve the aspect ratio, which the cheat sheet shows the syntax for.

04 · IMAGEMAGICK

ImageMagick without losing your originals

Know which command you're running

ImageMagick 7 consolidated its tools behind a single magick command. The older convert is legacy and, confusingly, collides with an unrelated Windows utility of the same name. Most tutorials online were written for version 6, so if a command from a blog post behaves strangely, a version mismatch is the first thing to check.

One command edits in place, and it is unforgiving

ImageMagick's batch tool overwrites the files it processes rather than writing copies. This is genuinely useful for resizing a folder of images in one pass, and it is also the fastest way to destroy a set of originals with a mistyped percentage. There is no undo.

WATCH OUTCopy the folder before any in-place batch operation. Every experienced user has a story about this one. Run the command against a duplicate directory, check a few results, and only then repeat it on anything you care about. A one-line copy is cheap insurance against an irreversible mistake.

Security settings may block some formats

After a well-publicized set of vulnerabilities involving maliciously crafted images, many distributions ship ImageMagick with a restrictive policy file that disables certain formats by default. If a conversion fails with a permission error on a format that should obviously work, that policy is usually the cause rather than anything wrong with your command.

05 · FAQ

Frequently asked questions

Are FFmpeg and ImageMagick free?

Yes. Both are free and open source, with no license fee for personal or commercial use, and both run on Windows, macOS, and Linux. The Devhints cheat sheets listed here are also free to read with no account required.

Do I need to know the command line to use them?

Some comfort with a terminal helps, but less than people expect. Most real tasks are a single command copied from a reference with the filenames changed. If you can navigate to a folder and run one line, you can use both tools productively.

Why did my ImageMagick command overwrite my original images?

Because the batch tool edits files in place by design rather than writing copies. It is intended for applying one operation across a whole directory, and it has no undo. Always run it against a duplicate folder first.

Why is my FFmpeg conversion so slow?

Almost always because it is re-encoding when it does not need to. If you are only changing the container format or trimming on a rough boundary, copying the streams avoids decoding and re-encoding entirely and finishes in seconds without any quality loss.

Should I use these instead of a graphical editor?

Use them when the job is repetitive, scriptable, or applies to many files at once, which is where they are dramatically faster than clicking. For detailed visual work on a single image, a graphical editor remains the better tool. The two approaches complement each other rather than competing.

More cheat sheets

Quick references by area.