Share
ffmpeg

FFmpeg Cheat Sheet & Guide: Essential Audio & Video Commands (2026)

  • June 16, 2025

CLI ENGINE // AUDIO & VIDEO TRANSCODINGOPEN-SOURCE // CROSS-PLATFORM

FFmpeg is the Swiss-army-knife command-line engine behind almost every modern media player, converter, and streaming pipeline. Whether you are batch-converting DJ mixes, extracting lossless audio, resizing 4K captures, or remuxing containers with zero quality loss, FFmpeg handles it directly from the terminal.

Master FFmpeg on Windows, Linux, and macOS with ready-to-copy terminal commands for converting formats, extracting audio, trimming clips, and H.264 compression.

01 // Installation Across Platforms

Windows 11 (Winget) winget install Gyan.FFmpeg
Linux (Arch / Debian / Fedora) sudo pacman -S ffmpeg sudo apt install ffmpeg sudo dnf install ffmpeg
macOS (Homebrew) brew install ffmpeg

02 // Essential Terminal Commands

Convert Container Format (Zero Re-Encoding)

REMUX // INSTANT

Swaps the container (e.g., MKV to MP4) without re-encoding video or audio streams—completes in seconds with zero quality loss.

ffmpeg -i input.mkv -c copy output.mp4

Extract Audio from Video

AUDIO // MP3 V0

Strips the audio track from a recorded live stream or video file and encodes it as high-bitrate variable MP3.

ffmpeg -i video.mp4 -vn -q:a 0 audio.mp3

Resize Video to 720p

SCALE // 1280×720

Downscales high-resolution footage cleanly to 1280×720 HD for web uploads or lightweight sharing.

ffmpeg -i input.mp4 -vf "scale=1280:720" -c:a copy output.mp4

Trim Clip by Timestamp

CUT // -SS TO -TO

Extracts a segment between 00:00:10 and 00:01:00 using stream copy so no re-encoding is required.

ffmpeg -ss 00:00:10 -to 00:01:00 -i input.mp4 -c copy clip.mp4

Compress & Re-Encode to H.264

LIBX264 // CRF 23

Balances file size and visual sharpness using Constant Rate Factor (-crf 18 for near-lossless, -crf 23 for standard web).

ffmpeg -i input.mp4 -c:v libx264 -preset fast -crf 23 -c:a aac -b:a 192k output.mp4

Capture Frame Screenshot at Timestamp

FRAME GRAB // PNG / JPG

Seeks directly to 10 seconds before decoding so it grabs a single lossless PNG (or JPEG) frame almost instantaneously.

ffmpeg -ss 00:00:10 -i input.mp4 -vframes 1 output.png
  • -ss 00:00:10 — Placed before -i for fast keyframe seeking to the 10-second mark.
  • -vframes 1 — Captures exactly one single video frame and exits.
  • output.jpg — Swap the extension to .jpg if you want a smaller JPEG thumbnail instead of PNG.