Back to roadmaps ffmpeg Course

FFmpeg Command-Line Reference Cheat Sheet

This quick reference guide summarizes the most commonly used FFmpeg operations.


1. Core Input / Output Flags

Flag Purpose
-i input.mp4 Specify input file
-c:v codec Set video encoder (e.g. libx264, libvpx-vp9)
-c:a codec Set audio encoder (e.g. aac, libmp3lame)
-c copy Copy all streams without re-encoding
-vn Disable video output
-an Disable audio output
-ss 00:01:30 Seek to position before processing
-t 00:00:30 Limit output duration to 30 seconds
-vframes 1 Output only one video frame

2. Common Recipes

# Compress MP4 with H.264
ffmpeg -i input.mp4 -c:v libx264 -crf 23 -c:a aac output.mp4

# Convert MP4 to WebM
ffmpeg -i input.mp4 -c:v libvpx-vp9 -crf 30 -b:v 0 -c:a libopus output.webm

# Extract audio as MP3
ffmpeg -i input.mp4 -vn -acodec libmp3lame -ab 192k output.mp3

# Extract a frame at 5 seconds
ffmpeg -i input.mp4 -ss 00:00:05 -vframes 1 thumb.jpg

# Scale to 1280px width
ffmpeg -i input.mp4 -vf "scale=1280:-1" output_scaled.mp4

# Remove audio from video
ffmpeg -i input.mp4 -an -c:v copy output_silent.mp4

# Trim from 1:00 to 1:30
ffmpeg -i input.mp4 -ss 00:01:00 -t 00:00:30 -c copy output_trim.mp4
Published on Last updated: