← Back to Blog

Reference · Feb 2026 · 7 min read

FFmpeg Cheat Sheet: 20 Common Commands You'll Actually Use

FFmpeg can do almost anything with video and audio. The problem is remembering the flags. Here's a practical cheat sheet of the commands you'll use most, plus an easier alternative for when you don't want to think about codecs.

Convert video formats

# MOV to MP4
ffmpeg -i input.mov -c:v libx264 -c:a aac output.mp4

# MKV to MP4 (remux, no re-encoding)
ffmpeg -i input.mkv -c copy output.mp4

# WebM to MP4
ffmpeg -i input.webm -c:v libx264 -c:a aac output.mp4

# AVI to MP4
ffmpeg -i input.avi -c:v libx264 -c:a aac -preset medium output.mp4

Compress video

# Compress with CRF (lower = better quality, 18-28 is useful range)
ffmpeg -i input.mp4 -c:v libx264 -crf 23 -c:a aac -b:a 128k output.mp4

# Target a specific file size (2-pass, 25MB target for 60s video)
ffmpeg -i input.mp4 -c:v libx264 -b:v 3000k -pass 1 -f null /dev/null
ffmpeg -i input.mp4 -c:v libx264 -b:v 3000k -pass 2 -c:a aac -b:a 128k output.mp4

# Scale down to 720p
ffmpeg -i input.mp4 -vf scale=-2:720 -c:v libx264 -crf 23 output.mp4

Extract audio

# MP4 to MP3
ffmpeg -i input.mp4 -vn -c:a libmp3lame -b:a 192k output.mp3

# Extract audio without re-encoding (if already AAC)
ffmpeg -i input.mp4 -vn -c:a copy output.aac

# MP4 to FLAC (lossless)
ffmpeg -i input.mp4 -vn -c:a flac output.flac

Convert audio formats

# WAV to MP3
ffmpeg -i input.wav -c:a libmp3lame -b:a 320k output.mp3

# FLAC to AAC
ffmpeg -i input.flac -c:a aac -b:a 256k output.m4a

# MP3 to OGG
ffmpeg -i input.mp3 -c:a libvorbis -q:a 6 output.ogg

Convert images

# PNG to WebP
ffmpeg -i input.png -c:v libwebp -quality 80 output.webp

# JPEG to AVIF
ffmpeg -i input.jpg -c:v libaom-av1 -still-picture 1 output.avif

# Resize image
ffmpeg -i input.png -vf scale=800:-1 output.png

Trim and cut

# Cut from 00:30 to 01:30 (1 minute clip)
ffmpeg -i input.mp4 -ss 00:00:30 -to 00:01:30 -c copy output.mp4

# First 10 seconds
ffmpeg -i input.mp4 -t 10 -c copy output.mp4

Create GIF from video

# Basic GIF (low quality)
ffmpeg -i input.mp4 -vf "fps=10,scale=480:-1" output.gif

# High-quality GIF (two-pass with palette)
ffmpeg -i input.mp4 -vf "fps=15,scale=480:-1:flags=lanczos,palettegen" palette.png
ffmpeg -i input.mp4 -i palette.png -filter_complex "fps=15,scale=480:-1:flags=lanczos[v];[v][1:v]paletteuse" output.gif

Merge audio and video

# Add audio track to video
ffmpeg -i video.mp4 -i audio.mp3 -c:v copy -c:a aac -shortest output.mp4

# Replace audio track
ffmpeg -i video.mp4 -i newaudio.mp3 -c:v copy -c:a aac -map 0:v:0 -map 1:a:0 output.mp4

Get file info

# Show detailed format and stream info
ffprobe -v quiet -print_format json -show_format -show_streams input.mp4

The easier way

FFmpeg is powerful but the syntax is dense. Every command above requires you to know the right codec, the right flags, and the right order. For common conversions, there's a simpler approach:

# Instead of remembering FFmpeg flags:
ffmpeg -i input.mov -c:v libx264 -c:a aac -preset medium output.mp4

# Just tell ConvX what you want:
convx convert input.mov --to mp4

# Instead of two-pass encoding for Discord:
ffmpeg -i input.mp4 -c:v libx264 -b:v 3000k -pass 1 -f null /dev/null
ffmpeg -i input.mp4 -c:v libx264 -b:v 3000k -pass 2 -c:a aac output.mp4

# One command:
convx convert input.mp4 --preset discord-video

# Instead of remembering WebP flags:
ffmpeg -i input.png -c:v libwebp -quality 80 output.webp

# Just:
convx convert input.png --to webp -q 80

ConvX uses FFmpeg (and other tools) under the hood. It handles the codec selection, quality mapping, and flag combinations for you. When you need full FFmpeg control, use FFmpeg. When you want to convert something quickly, ConvX saves you the documentation dive.

All the power, none of the flags. ConvX wraps FFmpeg, libvips, and more into simple commands and presets. Get ConvX for $20 →