FFmpeg Cheatsheet - Media Processing
All essential FFmpeg commands organized by use case, with 39+ entries you can copy and run directly. Find the right command fast when you need it.
Back to SysOpsFormat Conversion 6
ffmpeg -i input.mp4 output.aviConvert container; auto-select encoder
ffmpeg -i input.mp4 -c:v libx264 output.mp4Re-encode with H.264
ffmpeg -i input.mp4 -c:v libx265 output.mp4Encode to H.265 (smaller)
ffmpeg -i input.wav -c:a libmp3lame -q:a 2 output.mp3WAV to MP3, -q:a 2 ~190kbps
ffmpeg -i input.mp4 -c:v copy -c:a copy output.mkvStream copy into MKV, very fast
ffmpeg -i input.gif -movflags faststart output.mp4GIF to MP4, faststart for web
Trim & Crop 5
ffmpeg -i input.mp4 -ss 00:01:00 -to 00:02:00 -c copy clip.mp4Cut 1:00-2:00, -c copy fast
ffmpeg -ss 10 -i input.mp4 -t 30 clip.mp4Start at 10s, take 30s (-ss before -i)
ffmpeg -i input.mp4 -vf "crop=640:480:0:0" output.mp4Crop to 640x480 at (0,0)
ffmpeg -i input.mp4 -vf "crop=iw/2:ih:0:0" output.mp4Crop the left half
ffmpeg -i input.mp4 -vf "scale=1280:720:force_original_aspect_ratio=decrease,pad=1280:720:-1:-1:black" output.mp4Scale and pad to 1280x720 with black bars
Extract & Separate 6
ffmpeg -i input.mp4 -vn audio.aacExtract audio, -vn drops video
ffmpeg -i input.mp4 -an video_only.mp4Drop audio, keep video (-an)
ffmpeg -i input.mp4 -vf "select=eq(pict_type\,I)" -vsync vfr thumb_%03d.pngExtract keyframes as images
ffmpeg -i input.mp4 -r 1 frame_%03d.pngExtract one frame per second
ffmpeg -i input.mp4 -map 0:s:0 subtitle.srtExtract subtitle track to SRT
ffmpeg -i "image_%03d.png" -r 30 video.mp4Images to video
Compression & Quality 6
ffmpeg -i input.mp4 -c:v libx264 -crf 23 output.mp4CRF compress; higher = lower quality (18-28)
ffmpeg -i input.mp4 -c:v libx264 -crf 18 -preset slow output.mp4High quality; slow preset = smaller
ffmpeg -i input.mp4 -c:v libx264 -b:v 1M output.mp4Cap video bitrate at 1Mbps
ffmpeg -i input.mp4 -vf "scale=1280:-1" output.mp4Scale width to 1280px
ffmpeg -i input.mp4 -c:a aac -b:a 128k output.mp4Audio to AAC at 128kbps
ffmpeg -i input.mp4 -c:v libx264 -preset fast -tune zerolatency output.mp4Low-latency encode for live streaming
Watermark & Subtitle 5
ffmpeg -i input.mp4 -i logo.png -filter_complex "overlay=10:10" output.mp4Image watermark at top-left
ffmpeg -i input.mp4 -i logo.png -filter_complex "overlay=W-w-10:H-h-10" output.mp4Watermark at bottom-right
ffmpeg -i input.mp4 -vf "subtitles=sub.srt" output.mp4Burn SRT subtitles into video
ffmpeg -i input.mp4 -vf "drawtext=text=Hello:fontcolor=white:fontsize=24:x=10:y=10" output.mp4Add a text watermark
ffmpeg -i input.mp4 -i sub.srt -c copy -c:s mov_text output.mp4Soft (toggleable) subtitle in MP4
Audio 5
ffmpeg -i input.mp4 -c:a libmp3lame -b:a 192k output.mp3To MP3 at 192kbps
ffmpeg -i input.mp3 -af "volume=2.0" output.mp3Double the volume
ffmpeg -i input.mp4 -af "atempo=2.0" output.mp42x audio speed (pitch preserved)
ffmpeg -i input.mp3 -af "silenceremove=stop_periods=1:stop_duration=1:stop_threshold=-50dB" output.mp3Remove silent segments
ffmpeg -i "concat:a.mp3|b.mp3" -c copy output.mp3Concatenate audio files
Capture & Streaming 6
ffmpeg -f avfoundation -i "0:" -r 30 -t 60 screen.mp4macOS screen record 60s (avfoundation)
ffmpeg -f x11grab -i :0.0 -r 25 screen.mp4Linux screen record (X11)
ffmpeg -f v4l2 -i /dev/video0 -t 10 webcam.mp4Record webcam for 10s
ffmpeg -re -i input.mp4 -c copy -f flv rtmp://live.example.com/liveRTMP live push
ffmpeg -i http://example.com/stream.m3u8 -c copy output.mp4Download an HLS stream locally
ffmpeg -i input.mp4 -hls_time 10 -hls_list_size 0 output.m3u8Slice video into an HLS playlist
Tips
- -c copy only remuxes streams without re-encoding — very fast, but no filtering.
- Recommended CRF is 18-28: 18 near-lossless, 23 default, 28 smaller.
- -ss before -i is fast but imprecise; after -i is precise but slower.
- In scale, -1 means proportional; scale=1280:-1 sets width 1280, height auto.
- Slower -preset means better compression: ultrafast … veryslow.
- For live push, -re reads at the native rate to avoid overwhelming the server.
Official References
Commands are compiled from the official docs below. Click to verify the latest usage.
Maintained by LaoHand
Publicly updated on Jul 21, 2026, continuously proofread against official docs.
Contact Us
Wrong command or description? Send us corrections, business inquiries or product feedback by email.
Contact Us